# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
223342 | 2020-04-15T07:30:55 Z | spacewalker | Virus Experiment (JOI19_virus) | C++14 | 2000 ms | 2048 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; scanf("%d", &n); vector<ll> before(n), after(n); for (int i = 0; i < n; ++i) { scanf("%lld %lld", &before[i], &after[i]); } ll sanity = 0; for (int x : after) sanity += x; if (sanity == 0) { printf("No\n"); return 0; } vector<ll> negDelta(n); for (int i = 0; i < n; ++i) negDelta[i] = before[i] - after[i]; vector<ll> ans(n, -1); for (int i = 0; i < n; ++i) { ll multiplier = (1 << (n - 1)); ll potValue = 0; for (int offset = 0; offset < n; ++offset) { potValue += multiplier * negDelta[(i - offset + n) % n]; multiplier /= 2; } // printf("%d att potValue %lld\n", i, potValue); if (potValue >= 0 && potValue % ((1 << n) - 1) == 0) { ans[i] = potValue / ((1 << n) - 1); } } for (int i = 0; i < n; ++i) { if (ans[i] == -1) { printf("No\n"); return 0; } } printf("Yes\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2099 ms | 2048 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2099 ms | 2048 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |