# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1037345 | 2024-07-28T14:23:02 Z | Alfraganus | Intergalactic ship (IZhO19_xorsum) | C++17 | 2000 ms | 7420 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[j][0] - 1; x < S[j][1]; x ++) a[x] ^= S[j][2]; dfs(j + 1); for(int x = S[j][0] - 1; x < S[j][1]; x ++) a[x] ^= S[j][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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 452 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 452 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 21 ms | 348 KB | Output is correct |
7 | Correct | 21 ms | 348 KB | Output is correct |
8 | Correct | 21 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2043 ms | 7420 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2036 ms | 344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1908 ms | 344 KB | Output is correct |
2 | Correct | 1904 ms | 344 KB | Output is correct |
3 | Correct | 1883 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1908 ms | 344 KB | Output is correct |
2 | Correct | 1904 ms | 344 KB | Output is correct |
3 | Correct | 1883 ms | 348 KB | Output is correct |
4 | Execution timed out | 2062 ms | 604 KB | Time limit exceeded |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 452 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 21 ms | 348 KB | Output is correct |
7 | Correct | 21 ms | 348 KB | Output is correct |
8 | Correct | 21 ms | 348 KB | Output is correct |
9 | Correct | 1908 ms | 344 KB | Output is correct |
10 | Correct | 1904 ms | 344 KB | Output is correct |
11 | Correct | 1883 ms | 348 KB | Output is correct |
12 | Execution timed out | 2075 ms | 348 KB | Time limit exceeded |
13 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 452 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 21 ms | 348 KB | Output is correct |
7 | Correct | 21 ms | 348 KB | Output is correct |
8 | Correct | 21 ms | 348 KB | Output is correct |
9 | Correct | 1908 ms | 344 KB | Output is correct |
10 | Correct | 1904 ms | 344 KB | Output is correct |
11 | Correct | 1883 ms | 348 KB | Output is correct |
12 | Execution timed out | 2062 ms | 604 KB | Time limit exceeded |
13 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 452 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 21 ms | 348 KB | Output is correct |
7 | Correct | 21 ms | 348 KB | Output is correct |
8 | Correct | 21 ms | 348 KB | Output is correct |
9 | Execution timed out | 2043 ms | 7420 KB | Time limit exceeded |
10 | Halted | 0 ms | 0 KB | - |