// Problem: C. Non-coprime Split // Contest: Codeforces - Codeforces Round 895 (Div. 3) // URL: https://codeforces.com/contest/1872/problem/C // Memory Limit: 256 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h> using namespace std; #define ll long long //# define int long long #define ull unsigned long long #define pii pair<int,int> #define double long double #define baoliu(x, y) cout << fixed << setprecision(y) << x #define endl "\n"
const int N = 1e7; const int M = 1e7+ 10; const int inf = 0x3f3f3f3f; const int mod = 998244353; const double eps = 1e-8; int n, m;
// Problem: E. Data Structures Fan // Contest: Codeforces - Codeforces Round 895 (Div. 3) // URL: https://codeforces.com/contest/1872/problem/E // Memory Limit: 256 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h> using namespace std; #define ll long long //# define int long long #define ull unsigned long long #define pii pair<int,int> #define double long double #define baoliu(x, y) cout << fixed << setprecision(y) << x #define endl "\n"
const int N = 1e5 + 10; const int M = 1e6 + 10; const int inf = 0x3f3f3f3f; const int mod = 998244353; const double eps = 1e-8; int n, m; int a[N]; int sum[N]; void solve(){ int n; cin>>n; for(int i=1;i<=n;i++)cin>>a[i]; string s; cin>>s; int s0=0,s1=0; for(int i=1;i<=s.length();i++){ sum[i]=sum[i-1]^a[i]; if(s[i-1]=='0'){ s0^=a[i]; } else { s1^=a[i];
} } int q; cin>>q; while(q--){ int num; cin>>num; if(num==1){ int l,r; cin>>l>>r; int tmp=sum[r]^sum[l-1]; s1^=tmp;s0^=tmp; } else { int x; cin>>x; if(x==0)cout<<s0<<" "; else cout<<s1<<" "; } } cout<<endl; } int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
// Problem: F. Selling a Menagerie // Contest: Codeforces - Codeforces Round 895 (Div. 3) // URL: https://codeforces.com/contest/1872/problem/F // Memory Limit: 256 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h> using namespace std; #define ll long long //# define int long long #define ull unsigned long long #define pii pair<int,int> #define double long double #define baoliu(x, y) cout << fixed << setprecision(y) << x #define endl "\n"
const int N = 2e5 + 10; const int M = 1e6 + 10; const int inf = 0x3f3f3f3f; const int mod = 998244353; const double eps = 1e-8;
// Problem: G. Replace With Product // Contest: Codeforces - Codeforces Round 895 (Div. 3) // URL: https://codeforces.com/contest/1872/problem/G // Memory Limit: 256 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.h> using namespace std; #define ll long long # define int long long #define ull unsigned long long #define pii pair<int,int> #define double long double #define baoliu(x, y) cout << fixed << setprecision(y) << x #define endl "\n"
const int N = 2e5 + 10;
const int M = 1e6 + 10; const int inf = 0x3f3f3f3f; const int mod = 998244353; const double eps = 1e-8; int n, m; int a[N]; int s[N]; void solve(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; s[i]=s[i-1]+a[i]; } int l=1;int r=n; while(l<=n&&a[l]==1)l++; while(r>=1&&a[r]==1)r--; if(l==n+1){ cout<<1<<" "<<1<<endl; return ; } int res=1; bool flag=false; for(int i=1;i<=n;i++){ if(a[i]!=1){ if(res*a[i]>=4e5){ flag=true; break; } res*=a[i]; } } if(flag){ cout<<l<<" "<<r<<endl; return ; } //cerr<<l<<" "<<r<<endl; vector<int>b; b.push_back(0); for(int i=1;i<=n;i++){ if(a[i]!=1)b.push_back(i); } int st=1,ed=1; int mx=s[n]; int m=b.size()-1; for(int i=1;i<=m;i++){ int res=1; int posl=b[i]; for(int j=i;j<=m;j++){ int posr=b[j]; res*=a[posr]; int tmp=s[n]-(s[posr]-s[posl-1])+res; if(mx<tmp){ mx=tmp; st=posl; ed=posr; } //cerr<<mx<<endl; } } cout<<st<<" "<<ed<<endl; } signed main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);