# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1037342 | 2024-07-28T14:21:46 Z | Alfraganus | Intergalactic ship (IZhO19_xorsum) | C++17 | 2000 ms | 8220 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define str string #define fastio ios::sync_with_stdio(0), cin.tie(0); #define fs first #define ss second #define endl '\n' #define all(x) (x).begin(), (x).end() #define len(x) x.size() #define print(a) \ for (auto &x : a) \ cout << x << " "; \ cout << endl; #define printmp(a) \ for (auto &x : a) \ cout << x.fs << " " << x.ss << endl; const int mod = 1e9 + 7; vector<int> a; vector<array<int, 3>> S; int ans = 0; void dfs(int p){ for(int i = 0; i < a.size(); i ++){ int sum = 0; for(int j = i; j < a.size(); j ++){ sum += a[j]; sum %= mod; ans = (ans + sum * sum) % mod; } } for(int j = p; j < S.size(); j ++){ for(int x = S[p][0] - 1; x < S[p][1]; x ++) a[x] ^= S[p][2]; dfs(j + 1); for(int x = S[p][0] - 1; x < S[p][1]; x ++) a[x] ^= S[p][2]; } } void solve(){ int n; cin >> n; a.resize(n); for(int i = 0; i < n; i ++) cin >> a[i]; int q; cin >> q; S.resize(q); for(int i = 0; i < q; i ++) cin >> S[i][0] >> S[i][1] >> S[i][2]; dfs(0); cout << ans; } signed main() { fastio; #ifdef Javohir freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int t = 1; // cin >> t; while (t--) { solve(); cout << endl; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 460 KB | Output is correct |
3 | Incorrect | 0 ms | 348 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 460 KB | Output is correct |
3 | Incorrect | 0 ms | 348 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2041 ms | 8220 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2032 ms | 460 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1799 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1799 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 460 KB | Output is correct |
3 | Incorrect | 0 ms | 348 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 460 KB | Output is correct |
3 | Incorrect | 0 ms | 348 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 460 KB | Output is correct |
3 | Incorrect | 0 ms | 348 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |