source_code
stringlengths
26
62k
lang_cluster
stringclasses
11 values
src_uid
stringlengths
32
32
code_uid
stringlengths
32
32
difficulty
int32
-1
3.5k
exec_outcome
stringclasses
1 value
#include <bits/stdc++.h> using namespace std; #define qc ios::sync_with_stdio(0) #define ll long long #define pb push_back #define mp make_pair #define fi first #define se second #define int ll typedef pair<char, int> Pair; signed main() { qc,cin.tie(0); int t; cin>>t; while(t--){ int n,k,x; cin...
C++
32ed4995e557cfdcbef375e2b9edb1a6
7c3d9ba33945952d0b82cd9d6cc5a540
1,800
PASSED
#include<bits/stdc++.h> using ll = long long; #define debug(x) cout << #x << " -> " << x << endl #define bit(x,i)(((x)>>(i))&1) #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; #define int ll string s; int n,k,x; stack<char> st; void solve(){ cin>>n>>k>>x; ...
C++
32ed4995e557cfdcbef375e2b9edb1a6
6229120095c4eee1e5183dd13ad7f223
1,800
PASSED
#include<bits/stdc++.h> #define int long long #define debug(x) cout << #x << " -> " << x << endl using namespace std; char a[2005]; int star[2005],ans[2005]; __int128 mut[2005]; int n,k,x; void solve(){ memset(ans,0,sizeof ans); memset(star,0,sizeof star); memset(mut,0,sizeof mut); sca...
C++
32ed4995e557cfdcbef375e2b9edb1a6
bcfffdbafda3b9504e5f796c33273109
1,800
PASSED
#include<bits/stdc++.h> #define int long long #define debug(x) cout << #x << " -> " << x << endl using namespace std; char a[2005]; int star[2005],ans[2005]; int mut[2005]; int n,k,x; void solve(){ memset(ans,0,sizeof ans); memset(star,0,sizeof star); memset(mut,0,sizeof mut); scanf("%...
C++
32ed4995e557cfdcbef375e2b9edb1a6
4c64b07b160fd0a53abbcea4b5e3f838
1,800
PASSED
#include<bits/stdc++.h> using namespace std; void solve(){ int n,k; long long x; string s; cin>>n>>k>>x>>s; x--; int cnt=0,stIDX; vector<pair<int,int>> v; for(int i=0;i<n;i++){ if(s[i]=='*'){ if(cnt==0) stIDX=i; cnt++; } if(cnt>0 && (i==n-1 || s[i]=='a')) v.push_back({s...
C++
32ed4995e557cfdcbef375e2b9edb1a6
d9ed1fc3bcefb5aa0ccdad4f0addc126
1,800
PASSED
#include<bits/stdc++.h> using namespace std; void solve(){ int n; long long k,x; string s; cin>>n>>k>>x>>s; x--; int cnt=0,stIDX=0; vector<pair<int,int>> v; for(int i=0;i<n;i++){ if(s[i]=='*'){ if(cnt==0) stIDX=i; cnt++; } if(cnt>0 && (...
C++
32ed4995e557cfdcbef375e2b9edb1a6
b395b24800fb397193aa85e383662340
1,800
PASSED
#include <bits/stdc++.h> using namespace std; typedef unsigned long long ll; const int N = 2010; ll cnt[N], ans[N]; vector<int> v; ll ne[N]; void solve() { v.clear(); int n, k; ll x; cin >> n >> k >> x; string s; cin >> s; for (int i = 0; i < n; i++) ans[i] = 0; for (int...
C++
32ed4995e557cfdcbef375e2b9edb1a6
db2297d24b08635ed1f39356dd46ee04
1,800
PASSED
#pragma GCC optimize("Ofast", "inline", "-ffast-math") #pragma GCC target("avx,sse2,sse3,sse4,mmx") #include<bits/stdc++.h> #define inf 0x3f3f3f3f #define int long long #define ll unsigned long long using namespace std; const int N=5e3+7; int read(){ int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch==...
C++
32ed4995e557cfdcbef375e2b9edb1a6
d98f07493985ad728f5ccc6349b93b01
1,800
PASSED
#include <bits/stdc++.h> using namespace std; const int maxN = 1000005; int DP[maxN][2], a[maxN], tmp[4][2]; void solve() { int n; cin >> n; for(int i = 0; i < n; i++) { cin >> a[i]; DP[i][0] = DP[i][1] = -1e9; } DP[n - 1][0] = DP[n - 1][1] = 1e9; for(int i = n - 1;...
C++
2ac1d45db008fb4cbb503d0c1bcec200
f248ca081e2402b76b81e3ab985c560c
2,800
PASSED
#include<stdio.h> const int maxn=1000005; int T,n; int a[maxn],f[maxn][2],rec[maxn][2]; int main(){ scanf("%d",&T); while(T--){ scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); f[1][0]=f[1][1]=-n-1; for(int i=2;i<=n;i++) for(int j=0;j<=1;j++){ int x=j==0? a[i]:-a[i]; f[i][j...
C++
2ac1d45db008fb4cbb503d0c1bcec200
0d87c8596e936f48174ecf9c9b33564b
2,800
PASSED
#include<bits/stdc++.h> using namespace std; #define pii pair<int,int> #define sec second #define fir first #define int long long #define pb push_back #define rep(i,a,b) for(int i=a;i<=b;++i) #define Down(i,a,b) for(int i=a;i>=b;--i) template<typename T>inline void ckmax(T &x,T y){x=x<y?y:x; return ;} templa...
C++
2ac1d45db008fb4cbb503d0c1bcec200
bee1cb85259c5a53510e63b9149a9f3f
2,800
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 1e6+6; char buf[1<<23],*p1=buf,*p2=buf; #define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++) int read(){ int s=0,w=1; char ch=getchar(); while(!isdigit(ch)){if(ch=='-')w=-1; ch=getchar();} while(isdigit(ch))s...
C++
2ac1d45db008fb4cbb503d0c1bcec200
51aec7dfe2ef319472c7243702cd7904
2,800
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 1e6+6; char buf[1<<23],*p1=buf,*p2=buf; #define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++) int read(){ int s=0,w=1; char ch=getchar(); while(!isdigit(ch)){if(ch=='-')w=-1; ch=getchar();} while(isdigit(ch))s...
C++
2ac1d45db008fb4cbb503d0c1bcec200
9dd2e1f61045fd1333ac7990f5fb733f
2,800
PASSED
#include<bits/stdc++.h> using namespace std; const int N = 1e6+6; char buf[1<<23],*p1=buf,*p2=buf; #define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++) int read(){ int s=0,w=1; char ch=getchar(); while(!isdigit(ch)){if(ch=='-')w=-1; ch=getchar();} while(isdigit(ch))s...
C++
2ac1d45db008fb4cbb503d0c1bcec200
4bd210f6aff9cb0424ea6ace77d19ed1
2,800
PASSED
#include <bits/stdc++.h> using namespace std; #define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++) char buf[1 << 21], *p1 = buf, *p2 = buf; inline int qread() { register char c = getchar(); register int x = 0, f = 1; while (c < '0' || c > '9') { if (c == '-') f = -1; c...
C++
2ac1d45db008fb4cbb503d0c1bcec200
e0dc304bb15fc3d5786839933f2c54bf
2,800
PASSED
// LUOGU_RID: 90375853 #include <bits/stdc++.h> using namespace std; inline int read() { int s=0,f=1; char c=getchar(); while(c<'0'||c>'9') { if(c=='-') f=-1; c=getchar(); } while(c>='0'&&c<='9') { s=s*10+c-'0'; c=getchar(); } return s*f; } int T; int n; int a[1000007]; bool pd...
C++
2ac1d45db008fb4cbb503d0c1bcec200
971271f8a2b7a5cfd5586d1b3c97d550
2,800
PASSED
#include <bits/stdc++.h> using namespace std; inline int read() { int s=0,f=1; char c=getchar(); while(c<'0'||c>'9') { if(c=='-') f=-1; c=getchar(); } while(c>='0'&&c<='9') { s=s*10+c-'0'; c=getchar(); } return s*f; } int T; int n; int a[1000007]; bool pd[1000007]; int f[10000...
C++
2ac1d45db008fb4cbb503d0c1bcec200
4deee3f1e492ce9d0858af997d4fd993
2,800
PASSED
#include<bits/stdc++.h> #define N 1000005 #define inf 999999999 using namespace std; int t,n,a[N]; int f[N][2],tmp[4][2]; int main() { cin>>t; while(t--) { int fl=0; scanf("%d",&n); for(int i=1;i<=n;++i) { scanf("%d",&a[i]); f[i][0]=f[i][1]=-inf; } f[n][0]=f[n][1]=inf; for(int ...
C++
2ac1d45db008fb4cbb503d0c1bcec200
363b7d2a1e4a1fa583fbb81abfc92ace
2,800
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define f first #define s second const int N = 3e5+5; const int mod = 998244353; int n , freq[23][26] , ones[1<<23] , dp[1<<23][24] , val[1<<23] , curC , ss , sum[1<<23] , tot=0; string str[25]; stack< int > sk[27]; ...
C++
d0f886a563cfc960fb4839df91f27815
f9c138a1913bbf63d2e94103831350f4
2,400
PASSED
#include<bits/stdc++.h> using namespace std; // #define int int // when you got tle but tc is right do this and make as global as possible #define endl "\n" // const int MAX =1000000000000000000; long long mod= 998244353; long double pi=3.141592653589793238; void pls() { ios_base::sync_with_stdio(0); cin...
C++
d0f886a563cfc960fb4839df91f27815
562dcf89f0cc0ce8baf9aa5719da5330
2,400
PASSED
#include<bits/stdc++.h> using namespace std; #define int long long // when you got tle but tc is right do this and make as global as possible #define endl "\n" // const int MAX =1000000000000000000; long long mod= 998244353; long double pi=3.141592653589793238; #define setbits(x) __builtin_popcountll(x)...
C++
d0f886a563cfc960fb4839df91f27815
9f2468c993773ef12e531eab6633eca8
2,400
PASSED
#include <bits/stdc++.h> #define int long long using namespace std; const int N=1<<23; const int M=20010; const int mod=998244353; char t[M]; signed n,s[30][24],f[2][N],minv[30]; int ans; int Mod(int x){ return x>=mod?x-mod:x; } signed main(){ scanf("%d",&n); for(int i=1;i<=n;i++){ ...
C++
d0f886a563cfc960fb4839df91f27815
5dc515f599ad29548e578cf860876b6a
2,400
PASSED
#include<cstdio> #include<algorithm> #include<ctype.h> #include<cstring> #define int long long using namespace std; inline int read() { int x=0,f=1;char ch=getchar(); while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();} while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();} return x*f; } const int Mod=9...
C++
d0f886a563cfc960fb4839df91f27815
504d6e7ff2ef3a53b65281e03311cdd6
2,400
PASSED
#include <bits/stdc++.h> #define rep(i, x, y) for(int i = x; i <= y; i ++) #define rep0(i, x) for(int i = 0; i < x; i ++) #define rrep(i, x, y) for(int i = x; i >= y; i --) #define mp make_pair #define pb push_back #define X first #define Y second #define PII pair<int, int> #define inf 0x3f3f3f3f #define llf ...
C++
d0f886a563cfc960fb4839df91f27815
9f40c040d9919588e16b41c8f5d78bda
2,400
PASSED
#include <bits/stdc++.h> #define rep(i, x, y) for(int i = x; i <= y; i ++) #define rep0(i, x) for(int i = 0; i < x; i ++) #define rrep(i, x, y) for(int i = x; i >= y; i --) #define mp make_pair #define pb push_back #define X first #define Y second #define PII pair<int, int> #define inf 0x3f3f3f3f #define llf ...
C++
d0f886a563cfc960fb4839df91f27815
e85bce25e915fd54306eb001c10edb6b
2,400
PASSED
#include <bits/stdc++.h> #define rep(i, x, y) for(int i = x; i <= y; i ++) #define rep0(i, x) for(int i = 0; i < x; i ++) #define rrep(i, x, y) for(int i = x; i >= y; i --) #define mp make_pair #define pb push_back #define X first #define Y second #define PII pair<int, int> #define inf 0x3f3f3f3f #define ll...
C++
d0f886a563cfc960fb4839df91f27815
a811d71ba6888de173ef75e51f584b43
2,400
PASSED
#include <bits/stdc++.h> #define ld long double #define endl "\n" #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define pb push_back #define mp(a,b) make_pair(a,b) #define ms(v,x) memset(v,x,sizeof(v)) #define all(v) v.begin(),v.end() #define ff first #define ss second #define rep(i, a, b) for(int...
C++
d0f886a563cfc960fb4839df91f27815
4d87c102129cc10b71019b0cf831c040
2,400
PASSED
#include<bits/stdc++.h> #define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++) #define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--) #define rep(i,n)for(int i=0,_n=n;i<n;i++) #define ll long long #define pii pair<int,int> #define m_p make_pair #define pb push_back #define fi first #define se second #define int ll #...
C++
d0f886a563cfc960fb4839df91f27815
d6fc0e7351641a54e21997303586be03
2,400
PASSED
#include <iostream> using namespace std; #define mod 998244353 int main() { int t, n; cin >> t; while (t--) { unsigned long long int a[502]; a[0] = 1; cin >> n; if (n % 2 == 1) { cout << 0; } else { for (int i = 1; i...
C++
0b718a81787c3c5c1aa5b92834ee8bf5
61c6743fdbb2527e4d6bc30f284f2ef6
800
PASSED
#include <iostream> using namespace std; #define mod 998244353 int main() { int t, n; cin >> t; while (t--) { unsigned long long int a[502]; a[0] = 1; cin >> n; if (n % 2 == 1) { cout << 0; } else { for (int i = 1; i...
C++
0b718a81787c3c5c1aa5b92834ee8bf5
77a2415669a75184fc712709d785e94b
800
PASSED
#include<iostream> #include<algorithm> using namespace std; //#include<bits/stdc++.h> #define cf int t;cin>>t;while(t--) #define ll long long const int mod = 998244353; const int N = 100010; int a[N]; ll f(int n) { if (n <= 1)return 1; return (n * f(n - 1))%mod; } int main() { cf { int n; cin >> n; if (n % 2)...
C++
0b718a81787c3c5c1aa5b92834ee8bf5
37355c047f2c1f1efac7161f51466b2b
800
PASSED
#include<iostream> #define int long long using namespace std; int n, m; const int N = 998244353; void check() { cin >> m; int b = 1; if (m % 2 == 0) { for (int i = 1; i <= (m / 2); i++) { b = (b * i * i)%N; } cout << b << endl; } else { cou...
C++
0b718a81787c3c5c1aa5b92834ee8bf5
cb9e9d0d4672250232a4deaee5494853
800
PASSED
#include<bits/stdc++.h> using namespace std; const int N=2e5+10; const int pi=3.1415926; const int mod=998244353; typedef long long ll; int t; void cy(){ int n; cin>>n; if(n&1){ cout<<0<<endl; return; } ll k=1; for(int i=1;i<=n/2;i++) { k*=i*i%mod; k%=mod; } c...
C++
0b718a81787c3c5c1aa5b92834ee8bf5
0ea0e31aedf25c79bc657a390b8dae2d
800
PASSED
#include<bits/stdc++.h> using namespace std; const int N=2e5+10; const int pi=3.1415926; const int mod=998244353; typedef long long ll; int t; void cy(){ int n; cin>>n; if(n&1){ cout<<0<<endl; return; } ll kin=1; for(int i=1;i<=n/2;i++){ kin*=i*i%mod; kin%=mod; } ...
C++
0b718a81787c3c5c1aa5b92834ee8bf5
43d119fa73f85c38c63f6dae1fdb4317
800
PASSED
#include <iostream> using namespace std; #define mod 998244353 int main() { int t, n; cin >> t; while (t--) { unsigned long long int a[502]; a[0] = 1; cin >> n; if (n % 2 == 1) { cout << 0; } else { for (int i = 1; i...
C++
0b718a81787c3c5c1aa5b92834ee8bf5
109c44cf0809c10d55e743e31675c8e7
800
PASSED
#include<iostream> const long long mod = 998244353; using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; unsigned long long ans = 1; if (n % 2 == 0) { n /= 2; for (int i = 1; i <= n; i++) { ans = (ans * i) % mod; } ans = (ans * ans) % mod; cout << ans << endl; ...
C++
0b718a81787c3c5c1aa5b92834ee8bf5
5b87d6b36487cf0379137b31e27cbed7
800
PASSED
#include<iostream> using namespace std; #define MOD 998244353 #define ll long long ll fun(ll n) { ll sum = 1; for (int i = 2; i <= n; i++) sum *= i,sum%= MOD; return sum; } int main() { int t; cin >> t; while (t--) { ll n; cin >> n; if (n % 2)cout << 0 << '\n'; else cout <<fun(n/2)*fun(n/2)%MOD << '\n'...
C++
0b718a81787c3c5c1aa5b92834ee8bf5
96ea5a2a19f1787f529ae5ce50bcd685
800
PASSED
#include<bits/stdc++.h> #define endl '\n' const int mod=998244353; using namespace std; typedef long long ll; ll t,n; void fun(){ ll ans=1; cin>>n; if(n%2==0){ n=n/2; for(int i=1;i<=n;i++) { ans=(ans*i*i)%mod; } cout<<ans<<endl; } else cout<<0<<endl; } int main() { ios::sync_with_stdio(fa...
C++
0b718a81787c3c5c1aa5b92834ee8bf5
7d1df97ecf59e5450b9fb0c05b5bf2d5
800
PASSED
#include<iostream> #include<string> using namespace std; int main() { int t, n; string str; cin >> t; while (t--) { int k = 0; cin >> n >> str; for (int i = 0; i < n - 1; i++) { if (str[i] == '0' && str[i + 1] == '0') { k += 2; ...
C++
9966bfdc9677a9dd558684a00977cd58
b7c66a8503ee77a4d9d35756d862cf6f
800
PASSED
#include<iostream> #include<algorithm> using namespace std; //#include<bits/stdc++.h> #define cf int t;cin>>t;while(t--) #define ll long long const int mod = 1e9 + 7; const int N = 100010; int main() { cf { int n,sum=0; string a; cin >> n>>a; for (int i =1; i < n; i++) { if (a[i-1] == '0' && a[i] == '0')...
C++
9966bfdc9677a9dd558684a00977cd58
029083ac9766082f23614d3f2c0041bb
800
PASSED
#include<iostream> using namespace std; const int N = 100010; char a[N]; int n, m; void check() { cin >> m; for (int i = 0; i < m; i++) { cin >> a[i]; } int b = 0; for (int i = 0; i < m; i++) { for (int j = i + 1; j < m && j < i + 2; j++) { if (a[i] == a[j] && a[i] == '0') { b += 2; } else ...
C++
9966bfdc9677a9dd558684a00977cd58
bf89f34d6560cbc2340b8744001dd771
800
PASSED
#include<iostream> using namespace std; int main() { int t,n;string s; cin>>t; while(t--) { cin>>n>>s; int count=0,sum1=0,sum2=0; for(int i=0;i<n;i++) { if(s[i]=='0') { if(s[i+1]=='0') { count+=2;} if(s[i+1]=='1'&&s[i+2]=='0') { count+=1; }}} cout<<count<<endl; } } ...
C++
9966bfdc9677a9dd558684a00977cd58
46ef13a493ce1879c11bf0eae1837508
800
PASSED
/*000 4 001 2 010 1 011 0 100 2 101 0 110 0 111 0 1010110000100000101 女:7 男:12 11111111111111 14*/ #include<iostream> using namespace std; int main() { int t,n;string s; cin>>t; while(t--) { cin>>n>>s; int count=0,sum1=0,sum2=0; for(int i=0;i<n;i++) { if(s[i]=='0') { if(s[i+1]=='0') { count+=2;...
C++
9966bfdc9677a9dd558684a00977cd58
299443bec2c37aecb0937cbd4a65c17b
800
PASSED
#include <iostream> #include <string> using namespace std; int main() { char a,b,c; string s; int t; cin>>t; while(t--) { int n,ans=0,i=0; cin>>n; cin>>s; for(;s[i]!='0'&&i<n;i++) { } for(;i<n;) { if(s[i+1]=='1'&&s[i+2]=='0') ans++; else if(s[i+1]=='0') ans+=2; i++; for(;s[i]!='0'&&i...
C++
9966bfdc9677a9dd558684a00977cd58
290954b345c21ae560b298f15435b883
800
PASSED
#include<bits/stdc++.h> using namespace std; #define ll long long char s[110]; int main() { int t,n; cin>>t; while(t--) { cin>>n; cin>>s; int cnt0=0,cnt1=0,res=0; for(int i=0;i<n;i++) { if(s[i]=='0') cnt0++; else cnt1++; } int l=0,r=n-1; while(s[l]=='1') l++; while(s[r]=='1') r--; for(int ...
C++
9966bfdc9677a9dd558684a00977cd58
9876ec81ed7eba0b4f9c5f09fc6c8bbc
800
PASSED
#include<bits/stdc++.h> #define endl '\n' const int N=200; using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t,n; cin>>t; string a; while(t--) { int ans=0; cin>>n; cin>>a; for(int i=0;i<=a.size()-1;i++) { if(a[i]=='0'&&a[i+1]=='0') a...
C++
9966bfdc9677a9dd558684a00977cd58
1eb7218df68ea318d41528437efa9549
800
PASSED
#include<iostream> using namespace std; typedef long long ll; char c[110]; int main() { std::ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t, i; cin >> t; while (t--) { int n, s = 0; cin >> n >> c; i = 0; for (; i < n; i++) { if (c[i] == 49)continue; if (i + 1 < n && c[i + 1] == 48)s += 2...
C++
9966bfdc9677a9dd558684a00977cd58
395c72ddee956239e77c492b228995f4
800
PASSED
#include<iostream> using namespace std; int main() { int t; cin >> t; while (t--) { int n,ans = 0; string s; cin >> n>> s; for (int i = 0; i < s.size(); i++) { if (s[i] == '1') continue; if (i + 1 < s.size() && s[i + 1] == '0') ans += 2; if (i + 2 < s.size() && s[i + 1] == '1' && s[i + 2]...
C++
9966bfdc9677a9dd558684a00977cd58
45035bd861d3f71b3518ad205cad9373
800
PASSED
#include<iostream> #include<cstdio> #include<cmath> #include<string> #include<cstring> #include<algorithm> #include<queue> #include<stack> #include<vector> #include<map> #include<set> #include<bitset> using namespace std; inline int read(){ int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-...
C++
0e909868441b3af5be297f44d3459dac
2c370e6b1ae3a7bdc531e645d61927c3
2,500
PASSED
#include"bits/stdc++.h" #define pb push_back using namespace std; const int maxn = 2005; int n,k; int a[maxn][maxn]; char ans[maxn][maxn]; struct Point { int x, y; }; Point rk[maxn*maxn]; int minX, maxX, minY, maxY; void update (int x, int y) { minX = min(minX,x); minY = min(minY,y); ...
C++
0e909868441b3af5be297f44d3459dac
e262df1f4b5635052cb8c1ded50885df
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define fo(i,s,e) for( i=s;i<e;i++) #define rfo(i,s,e) for(i=s;i>e;i--) #define lli long long int const lli MOD=1e9+7; #define pb push_back #define pob pop_back() #define sp " " #define ff first #define ss second #define TIME cerr<<"Time Taken:...
C++
0e909868441b3af5be297f44d3459dac
44ee08759ea678df6e61b3551bfbfe47
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define fo(i,s,e) for( i=s;i<e;i++) #define rfo(i,s,e) for(i=s;i>e;i--) #define lli long long int const lli MOD=1e9+7; #define pb push_back #define pob pop_back() #define sp " " #define ff first #define ss second #define TIME cerr<<"Time Taken:...
C++
0e909868441b3af5be297f44d3459dac
fbe4617b4be282dbb842c85fe3a2a831
2,500
PASSED
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define fo(i,s,e) for( i=s;i<e;i++) #define rfo(i,s,e) for(i=s;i>e;i--) #define lli long long int const lli MOD=1e9+7; #define pb push_back #define pob pop_back() #define sp " " #define ff first #define ss second #define TIME cerr<<"Time Taken:...
C++
0e909868441b3af5be297f44d3459dac
d27942a326a6a17b9c3a288d876ee6ff
2,500
PASSED
#pragma GCC optimize(2) #pragma GCC optimize(3,"Ofast","inline") #include<bits/stdc++.h> #define N 4000005 using namespace std; int n,k,a[2005][2005],x,y,p1[N],p2[N],cnt,tot; char ans[2005][2005]; struct node{ int x,y; }p[N]; bool cmp(node u,node v){ return a[u.x][u.y]>a[v.x][v.y]; } void upd(){ node t...
C++
0e909868441b3af5be297f44d3459dac
c91b333727922cb47d582eb3b89e7129
2,500
PASSED
//#pragma GCC optimize("O3") //(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS) //#pragma comment(linker, "/stack:200000000") //(UNCOMMENT WHEN NEEDED) //#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include<bits/...
C++
0e909868441b3af5be297f44d3459dac
7b13839fe40f2fa7b49fa68bbe52fa4c
2,500
PASSED
//#pragma GCC optimize("O3") //(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS) //#pragma comment(linker, "/stack:200000000") //(UNCOMMENT WHEN NEEDED) //#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include<bits/...
C++
0e909868441b3af5be297f44d3459dac
da4149598554b992b0ec497cc689b791
2,500
PASSED
//#pragma GCC optimize("O3") //(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS) //#pragma comment(linker, "/stack:200000000") //(UNCOMMENT WHEN NEEDED) //#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include<bits/...
C++
0e909868441b3af5be297f44d3459dac
e57b26de1561c62325d24c4a40e7e108
2,500
PASSED
/* kaaa_kawai */ #include <iostream> #include <cmath> #include <algorithm> #include <queue> #include <set> #include <vector> #include <ctime> #include <map> using namespace std; long long int MOD=998244353; long long int n,m,q,k; long long int a[200005],id[1000005],b[1000005],c[1000005]; long lon...
C++
0e909868441b3af5be297f44d3459dac
a2a4790cdd38f4466e9c1a0d621d7d76
2,500
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; //4 0 3 1 2 class Node { public: Node* one; Node* zero; }; class trie { Node* root; public: trie() { root = new Node(); } void insert(int n) { Node* temp = root; for (int i = 31; i >=...
C++
354e27c81d3d57a64062b5daa05705ad
73a3e064d3b8fdaa768d4b0cae75da97
1,600
PASSED
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("-Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native") #pragma GCC optimize("-ffast-math") #pragma GCC optimize("-funroll-loops") #pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loo...
C++
354e27c81d3d57a64062b5daa05705ad
ed5fa9e49abab42e0783a7566ed95f2d
1,600
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace chrono; using namespace __gnu_pbds; #pragma GCC optimize("-Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native") #pragma GCC optimize("-ffast-math") #pragma GCC op...
C++
354e27c81d3d57a64062b5daa05705ad
41f2c5b81f5930f62bde542064cbb112
1,600
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace chrono; using namespace __gnu_pbds; // some hacks #define endl '\n' #define getline(a) scanf("%[^\n]%*c", a); #define newl cout<<endl; #pragma GCC optimize("-Ofast") #pragma GCC target("sse,sse2,sse3...
C++
354e27c81d3d57a64062b5daa05705ad
2a7d2f4a331489a3571b9933e81df8d2
1,600
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace chrono; using namespace __gnu_pbds; // some hacks #define endl '\n' #define getline(a) scanf("%[^\n]%*c", a); #define newl cout<<endl; #pragma GCC optimize("-Ofast") #pragma GCC target("sse,sse2,sse3...
C++
354e27c81d3d57a64062b5daa05705ad
95c7baa401510adf9e09230b71101bff
1,600
PASSED
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace chrono; using namespace __gnu_pbds; typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set_int; typedef tree<unsigned int,null_type,less<unsigned int>,rb_tree_tag,tre...
C++
354e27c81d3d57a64062b5daa05705ad
fcab2601cc9f2f3955181d0e80e529b9
1,600
PASSED
/* ** ** author: Omar_Hafez ** created: 27 March 2022 (Sunday) 5:33:03 PM ** */ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace chrono; using namespace __gnu_pbds; typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_u...
C++
354e27c81d3d57a64062b5daa05705ad
d8ce451e1951f10a37740a6fd5060ee7
1,600
PASSED
#include<bits/stdc++.h> using namespace std; struct FastIN { template < class T > inline FastIN& operator >> (T& x) { x = 0; bool sd(false); char ch(getchar()); while (!isdigit(ch) and (ch != '-')) ch = getchar(); if (ch == '-') sd = true, ch = getchar(); whil...
C++
354e27c81d3d57a64062b5daa05705ad
18b35e715e2d4cc989f3bd72e943d047
1,600
PASSED
#pragma GCC optimize("Ofast") #include <iostream> #include <fstream> #include <algorithm> #include <vector> #include <set> #include <unordered_set> #include <stack> #include <map> #include <unordered_map> #include <iomanip> #include <cmath> #include <queue> #include <bitset> #include <numeric> #include <...
C++
354e27c81d3d57a64062b5daa05705ad
90b0a06c5fd2fe7cd3390bfbb71ea10b
1,600
PASSED
#include <bits/stdc++.h> using namespace std; int arr[30][2]; int main() { int t; cin >> t; while(t--) { long long l, r; cin >> l >> r; memset(arr,0,sizeof arr); long long ans = 0; for(int i = l; i <= r; i++) { long long ...
C++
354e27c81d3d57a64062b5daa05705ad
26b64223e681458e22116a8dd4c747ae
1,600
PASSED
#include<bits/stdc++.h> #define rep(i,a,b) for( int i(a); i <= b; ++i) #define ll long long #define inf 1e15 #define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define PI acos(-1) #define fi first #define se second #define pb push_back #define debug(x) printf("x=%d\n",x); #define ls(x) arr[x]...
C++
e58fcbf5c49dc5666b1c65a0d5c76b6e
b533e07d73287b443eea67c32c74aa3b
2,300
PASSED
///*****Sellaris*****/// //#pragma once #pragma GCC optimize(2) #pragma GCC optimize(3) #include <bits/stdc++.h> //#include <bits/extc++.h> #define ll long long using namespace std; //using namespace __gnu_pbds; const int maxn=1e6+10; const int logn=20; inline int read(){ int ret=0,f=1;char ch...
C++
e58fcbf5c49dc5666b1c65a0d5c76b6e
a2b2f2aee4e7c2f95b9c44e77da6df5e
2,300
PASSED
///*****Sellaris*****/// //#pragma once #pragma GCC optimize(2) #pragma GCC optimize(3) #include <bits/stdc++.h> //#include <bits/extc++.h> #define ll long long using namespace std; //using namespace __gnu_pbds; const int maxn=1e6+10; const int logn=18; inline int read(){ int ret=0,f=1;char ch...
C++
e58fcbf5c49dc5666b1c65a0d5c76b6e
13c5c2135d90dcf2fe623feb9795601c
2,300
PASSED
///*****Sellaris*****/// //#pragma once #pragma GCC optimize(2) #pragma GCC optimize(3) #include <bits/stdc++.h> //#include <bits/extc++.h> #define ll long long using namespace std; //using namespace __gnu_pbds; const int maxn=1e6+10; const int logn=18; inline int read(){ int ret=0,f=1;char ch...
C++
e58fcbf5c49dc5666b1c65a0d5c76b6e
6a7dd4d9b960947804d842764c808f4a
2,300
PASSED
///*****Sellaris*****/// //#pragma once #pragma GCC optimize(2) #pragma GCC optimize(3) #include <bits/stdc++.h> //#include <bits/extc++.h> #define ll long long using namespace std; //using namespace __gnu_pbds; const int maxn=1e6+10; const int logn=18; inline int read(){ int ret=0,f=1;char ch...
C++
e58fcbf5c49dc5666b1c65a0d5c76b6e
ed7323b271467a7347ace5efd5597f02
2,300
PASSED
#include<bits/stdc++.h> #define N 1000005 #define int long long using namespace std; int T,l,r,a[N],cnt,trie[N][30],b[N]; void insert(int sum){ int now=0; for(int i=17;i>=0;i--){ bool tmp=(1<<i)&sum; if(!trie[now][tmp])trie[now][tmp]=++cnt; now=trie[now][tmp]; } } int Max(int sum){ int now=0,res...
C++
e58fcbf5c49dc5666b1c65a0d5c76b6e
1505a66bc4d66fa6df3453ca221b4f27
2,300
PASSED
///*****Sellaris*****/// //#pragma once //#pragma GCC optimize(2) //#pragma GCC optimize(3) #include <bits/stdc++.h> //#include <bits/extc++.h> #define ll long long using namespace std; //using namespace __gnu_pbds; const int maxn=3e5; inline int read(){ int ret=0,f=1;char ch=getchar(); while(!isdig...
C++
e58fcbf5c49dc5666b1c65a0d5c76b6e
5a76f9d3ed3fb6b706bc18baa9709781
2,300
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; bool b[300000]; for (int i = 0; i < 300000; i++) b[i] = false; while (t--) { int l, r; cin >> l >> r; int n = r - l + 1; int a[n]; for (int i = 0; i < n; i++) cin ...
C++
e58fcbf5c49dc5666b1c65a0d5c76b6e
cba46be2212a3f5022ea3c200aba7ec9
2,300
PASSED
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; bool b[300000]; for (int i = 0; i < 300000; i++) b[i] = false; while (t--) { int l, r; cin >> l >> r; if (l == 0) { if (r == 0) { int x; cin >> x; cout <<...
C++
e58fcbf5c49dc5666b1c65a0d5c76b6e
3dba0c9df928b38d4b8051020f810641
2,300
PASSED
// __builtin_popcount(x) broj bitova // __builtin_popcountll(x) // __builtin_clz(x) vodece nule // __builtin_clzll(x) // __builtin_ctz(x) nule na pocetku // __builtin_ctzll(x) // 2000000011 // 2000000033 #include "bits/stdc++.h" #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> #d...
C++
e58fcbf5c49dc5666b1c65a0d5c76b6e
e5c326391f9a26ea24f3e4f7c0c9e210
2,300
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector<int> vi; typedef vector<long long int> vll; typedef pair<int, int> pi; typedef pair<long long int, long long int> pll; int nCrModPDp(int n, int r, int p) { int C[r + 1]; memset(C, 0, sizeof(C)); C[0] = 1; ...
C++
a6c6b2a66ba51249fdc5d4188ca09e3b
926e565cbf1417b79e5daad43b243aff
1,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector<int> vi; typedef vector<long long int> vll; typedef pair<int, int> pi; typedef pair<long long int, long long int> pll; int nCrModPDp(int n, int r, int p) { int C[r + 1]; memset(C, 0, sizeof(C)); C[0] = 1; ...
C++
a6c6b2a66ba51249fdc5d4188ca09e3b
aa70544c3417dcb765a8d1ce052c56c5
1,700
PASSED
#include<bits/stdc++.h> #define ll long long #define N 300500 #define pb push_back #define fast ios_base::sync_with_stdio(0);cin.tie(0); using namespace std; const ll M=998244353; ll a[N],b[N]; int main() { fast ll i=0,j,k,n,m,ind,x,y; int t=1,tt=1; cin>>t; while(t--) { ...
C++
a6c6b2a66ba51249fdc5d4188ca09e3b
82f6a8131bee917121de6db321a3b98e
1,700
PASSED
#include <iostream> using namespace std; int main() { int t; cin>>t; for(int i=0;i<t;i++) { int n, gasit1=0, p1,prec; cin>>n>>prec; bool vb=1; p1=prec; if(p1==1) gasit1++; for(int j=2;j<=n;j++) { int x; ...
C++
a6c6b2a66ba51249fdc5d4188ca09e3b
d96781de8166769ce1d386eca3cf877b
1,700
PASSED
#include<bits/stdc++.h> #define int long long using namespace std; void solve(){ int n; cin>>n; vector<int> a(n); for(int i = 0; i < n; i++){ cin>>a[i]; } auto it = find(a.begin(),a.end(),1); if(it==a.end()){ cout<<"NO"<<endl; return; } rotate(a.begin(),it,a.end()); for(int i = 1; i < n...
C++
a6c6b2a66ba51249fdc5d4188ca09e3b
5f3cd448f17d3fedd595c13ce2068d76
1,700
PASSED
#include <bits/stdc++.h> using namespace std; #define ll long long int #define lll __int128_t #define F first #define S second #define pb push_back #define si set <int> #define msi multiset<int> #define vi vector ...
C++
a6c6b2a66ba51249fdc5d4188ca09e3b
7fa0588f7c42d030b74cad10d33c5c72
1,700
PASSED
#include <bits/stdc++.h> using namespace std; const int N = 1e6; int v[N], c[N]; void solve(){ int n; c[1] = 0; cin >> n; bool chk = 0; int cnt = 0; for(int i = 1; i <= n; i++){ cin >> v[i]; c[v[i]]++; } for(int i = 1; i <= n; i++){ if(v[i % n + 1] ...
C++
a6c6b2a66ba51249fdc5d4188ca09e3b
5da7d3ee7e593eaac4c4cf1445230b93
1,700
PASSED
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector<int> a(n); for (int &v: a) cin >> v; if (count(a.begin(), a.end(), 1) != 1) { cout << "NO\n"; return; } int p = find(a.begin(), a.end(), 1) - a.begin(); rotate(a.begin(), a.begi...
C++
a6c6b2a66ba51249fdc5d4188ca09e3b
d51be3c0f825248b60d41800c03b884b
1,700
PASSED
/* ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿ ⣿...
C++
a6c6b2a66ba51249fdc5d4188ca09e3b
c23b630275dfc933bea2b6b1efcd8f93
1,700
PASSED
#include<bits/stdc++.h> using ll = long long; const int N = 1e5 + 5; using namespace std; int t; int n; int c[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> t; while(t--) { cin >> n; memset(c, 0 ,sizeof(c)); bool flag = true; int idx = 0; int c...
C++
a6c6b2a66ba51249fdc5d4188ca09e3b
d03b70ea4cb045b8c83413b881c0827e
1,700
PASSED
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 1e6 + 5; int main() { ios :: sync_with_stdio(0), cin.tie(0); int tt; cin >> tt; while (tt--) { int n, m; string s; cin >> n >> m >> s; vector <int> a(n), b(n); if (s[0] == '0') a[0] = 1; else b[0] = 1; ...
C++
1d72b5ab8b6af0b7a02246ecd5e87953
321a1b68d3c26d8d7ec35656f8e7a803
2,700
PASSED
#include<bits/stdc++.h> using namespace std; #define LL long long #define pa pair<int,int> const int N=400010; LL read() { LL x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9')x=x*10ll+ch-'0',ch=getchar(); return x*f; } int n,m,a[N],cnt[2][N]; char s...
C++
1d72b5ab8b6af0b7a02246ecd5e87953
da7ad7050a08cb299fadb14e4fdaa62a
2,700
PASSED
#include<bits/stdc++.h> #define int long long const int N=1000050; using namespace std; basic_string<int> RES; int S(int l,int r){ return r-l+1; } void solve(){ int n,m;cin>>n>>m; string s;cin>>s; int c0=count(s.begin(),s.end(),'0'), c1=count(s.begin(),s.end(),'1'); int A=c0,B=c1; int g=__gc...
C++
1d72b5ab8b6af0b7a02246ecd5e87953
b553d3b7501394717dfa42ad41e63c6a
2,700
PASSED
/** * author: magnus_hegdahl * created: 27.03.2022 16:35 * problem: F. Juju and Binary String * url: https://codeforces.com/contest/1658/problem/F */ // <impyster.hpp> // <impyster/containers.hpp> #include <algorithm> #include <type_traits> #include <tuple> #include <utility> #include <vector> namespace impys...
C++
1d72b5ab8b6af0b7a02246ecd5e87953
6713d7d7fa63a1881b194e531437e8ad
2,700
PASSED
/** * author: magnus_hegdahl * created: 27.03.2022 16:35 * problem: F. Juju and Binary String * url: https://codeforces.com/contest/1658/problem/F */ // <impyster.hpp> // <impyster/containers.hpp> #include <algorithm> #include <type_traits> #include <tuple> #include <utility> #include <vector> namespace impys...
C++
1d72b5ab8b6af0b7a02246ecd5e87953
f88b31c60e83001ebf7670245bcc2f66
2,700
PASSED
#include <bits/stdc++.h> #define inf 1e18 #define eps 1e-14 #define maxm 100005 #define maxn 800005 #define ls (tot << 1) #define rs (tot << 1 | 1) #define PII pair<int, int> #define fi first #define se second typedef long long ll; typedef unsigned long long ull; using namespace std; const double pi = aco...
C++
1d72b5ab8b6af0b7a02246ecd5e87953
cbc03a7f0256a65921ec423f6f7ccade
2,700
PASSED
#include <bits/stdc++.h> using namespace std; typedef unsigned int ui; typedef long long ll; #define all(x) (x).begin(),(x).end() const int N=1e6+10; int a[N],s[N]; mt19937 rnd(time(0)); int main() { ios::sync_with_stdio(0);cin.tie(0); int T;cin>>T; while (T--) { int n,m,i,j,zeros,ones; if (1) ...
C++
1d72b5ab8b6af0b7a02246ecd5e87953
e074db5f4d12507cd1e20b6c2dba3b34
2,700
PASSED
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> #include <set> using namespace std; void solve(int test_ind){ int n, m; cin >> n >> m; string s; cin >> s; vector<int> d(n+1); for (int i=0;i<n;++i){ d[i+1] = d[i] + (s[i] == '1'); } long long x = d[n]; if ((x * m) ...
C++
1d72b5ab8b6af0b7a02246ecd5e87953
7bb8d5015244fb07ac6dedb8b3bc3859
2,700
PASSED
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 100; typedef long long ll; int n, k; int a[maxn]; string s; void solve(){ cin >> n >> k; cin >> s; int cur = 0; ll cnt = 0; for(int i = 0; i < n; i++) { if(s[i] == '1') { cnt++; } } ...
C++
1d72b5ab8b6af0b7a02246ecd5e87953
6909e1097bffbeef27446f5249e28222
2,700
PASSED
#include <bits/stdc++.h> using namespace std; int main () { ios_base::sync_with_stdio(0); cin.tie(0); int T; cin >> T; while (T--) { int n, m; cin >> n >> m; string s; cin >> s; int c = count(s.begin(), s.end(), '1'); if ((1LL*c*m) % n != 0) { cout << "-1\n"; continue; }...
C++
1d72b5ab8b6af0b7a02246ecd5e87953
49a4a1ed3e51e947d9fa943430e3d1f4
2,700
PASSED
import java.util.Arrays; import java.util.Scanner; public class EzzatAndTwoSubsequences { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int time = sc.nextInt(); for (int j = 0; j < time; j++) { int a = sc.nextInt(); int[] ...
Java
159b9c743d6d8792548645b9f7be2753
6604a2b40698f43aae1649749672218e
800
PASSED
import java.util.Scanner; public class EzzatAndTwoSubsequences { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int time = sc.nextInt(); for (int j = 0; j < time; j++) { int a = sc.nextInt(); int[] x = new int[a]; f...
Java
159b9c743d6d8792548645b9f7be2753
b30dd742d69246fa181fd44507503ed3
800
PASSED