Submission #559756

#TimeUsernameProblemLanguageResultExecution timeMemory
559756slimeFootball (info1cup20_football)C++14
26 / 100
25 ms488 KiB
#include "bits/stdc++.h" using namespace std; #define int long long #ifdef ONLINE_JUDGE const int MAXN = 2e5 + 10; #endif #ifndef ONLINE_JUDGE const int MAXN = 1029; #endif const int MOD = 1e9 + 7; #define ll __int128 mt19937_64 rng((int)std::chrono::steady_clock::now().time_since_epoch().count()); int rnd(int x, int y) { int u = uniform_int_distribution<int>(x, y)(rng); return u; } ll read() { int x; cin >> x; return (ll)x; } long long bm(long long b, long long p) { if(p==0) return 1 % MOD; long long r = bm(b, p >> 1); if(p&1) return (((r*r) % MOD) * b) % MOD; return (r*r) % MOD; } long long inv(long long b) { return bm(b, MOD-2); } long long f[MAXN]; long long nCr(int n, int r) { long long ans = f[n]; ans *= inv(f[r]); ans %= MOD; ans *= inv(f[n-r]); ans %= MOD; return ans; } void precomp() { for(int i=0; i<MAXN; i++) f[i] = (i == 0 ? 1 % MOD : (f[i-1] * i) % MOD); } int fastlog(int x) { return (x == 0 ? -1 : 32 - __builtin_clz(x) - 1); } void gay(int i) { cout << "Case #" << i << ": "; } void solve(int tc) { int n, k; cin >> n >> k; int s = 0; int a[n+1]; for(int i=1; i<=n; i++) { cin >> a[i]; s += a[i]; } if(k == 1) { cout << (s % 2 ? "1" : "0"); } if(n == 1) { cout << (a[1] % (k+1) ? "0" : "1"); } } int32_t main() { precomp(); ios::sync_with_stdio(0); cin.tie(0); int t = 1; cin >> t; for(int i=1; i<=t; i++) solve(i); } // I don't know geometry. // n = 13, k = 3: 0000001010000 // n = 13, k = 5: 0000010001000 // n = 13, k = 7: 0001000100010 // if k < n/2 and n odd: 1[010...10]111...1
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...