Submission #1062356

# Submission time Handle Problem Language Result Execution time Memory
1062356 2024-08-17T03:52:31 Z vjudge1 Intergalactic ship (IZhO19_xorsum) C++17
17 / 100
2000 ms 604 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1010;
const ll MOD = 1e9 + 7;
int a[N], b[N], c[N], l[N], r[N], x[N], qxor[N];
int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i = 1;i <= n;i++) {
        cin >> a[i];
    }
    int q;
    cin >> q;
    for (int i = 0;i < q;i++) cin >> l[i] >> r[i] >> x[i];
    ll res = 0;
    for (int i = 0;i < (1 << q);i++) {
        memset(qxor, 0, sizeof qxor);
        for (int j = 0;j < q;j++) {
            if (i & (1 << j)) {
                qxor[l[j]] ^= x[j];
                qxor[r[j] + 1] ^= x[j];
            }
        }
        ll ans = 0;
        ll sum1 = 0, sum2 = 0;
        for (int i = 1;i <= n;i++) {
            qxor[i] ^= qxor[i - 1];
            b[i] = a[i] ^ qxor[i];
            c[i] = b[i] * i;
            ans = (ans + 2 * sum2 * b[i] % MOD * (n + 1) % MOD) % MOD;
            sum1 = (sum1 + b[i]) % MOD;
            sum2 = (sum2 + c[i]) % MOD;
            ans = (ans + (n + 1) * b[i] * c[i]) % MOD;
        }
        ans = (ans - sum2 * sum2 % MOD + MOD) % MOD;
        res = (res + ans) % MOD;
    }
    cout << res << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2020 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 401 ms 348 KB Output is correct
2 Correct 406 ms 348 KB Output is correct
3 Correct 399 ms 456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 401 ms 348 KB Output is correct
2 Correct 406 ms 348 KB Output is correct
3 Correct 399 ms 456 KB Output is correct
4 Runtime error 1 ms 600 KB Execution killed with signal 11
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 401 ms 348 KB Output is correct
10 Correct 406 ms 348 KB Output is correct
11 Correct 399 ms 456 KB Output is correct
12 Incorrect 5 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 401 ms 348 KB Output is correct
10 Correct 406 ms 348 KB Output is correct
11 Correct 399 ms 456 KB Output is correct
12 Runtime error 1 ms 600 KB Execution killed with signal 11
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Runtime error 2 ms 604 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -