Submission #859796

# Submission time Handle Problem Language Result Execution time Memory
859796 2023-10-10T16:15:15 Z Alfraganus Intergalactic ship (IZhO19_xorsum) C++14
9 / 100
2000 ms 1624 KB
#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define ll long long
#define all(a) a.begin(), a.end()
#define fastio ios::sync_with_stdio(0), cin.tie(0);
#define fs first
#define ss second

#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 long long mod = 1e9 + 7;

void solve()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i ++)
        cin >> a[i];
    int q;
    cin >> q;
    vector<pair<pair<int, int>, int>> S(q);
    for(int i = 0; i < q; i ++){
        int l, r, x;
        cin >> l >> r >> x;
        l --;
        r --;
        S[i] = {{l, r}, x};
    }
    int ans = 0;
    for(int i = 0; i < (1 << q); i ++){
        vector<int> b = a;
        for(int j = 0; j < q; j ++){
            if((i & (1 << j))){
                for(int x = S[j].fs.fs; x <= S[j].fs.ss; x ++){
                    b[x] ^= S[j].ss;
                }
            }
        }
        for(int i = 0; i < n; i ++){
            int s = 0;
            for(int j = i; j < n; j ++){
                s = (s + b[j]) % mod;
                ans = (ans + s * s) % mod;
            }
        }
    }
    cout << ans;
}

signed main()
{
    fastio int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
        cout << endl;
    }
}
# 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 1 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 1 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 21 ms 348 KB Output is correct
7 Correct 22 ms 348 KB Output is correct
8 Correct 22 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 1624 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2039 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1991 ms 424 KB Output is correct
2 Execution timed out 2004 ms 440 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1991 ms 424 KB Output is correct
2 Execution timed out 2004 ms 440 KB Time limit exceeded
3 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 1 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 21 ms 348 KB Output is correct
7 Correct 22 ms 348 KB Output is correct
8 Correct 22 ms 348 KB Output is correct
9 Correct 1991 ms 424 KB Output is correct
10 Execution timed out 2004 ms 440 KB Time limit exceeded
11 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 1 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 21 ms 348 KB Output is correct
7 Correct 22 ms 348 KB Output is correct
8 Correct 22 ms 348 KB Output is correct
9 Correct 1991 ms 424 KB Output is correct
10 Execution timed out 2004 ms 440 KB Time limit exceeded
11 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 1 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 21 ms 348 KB Output is correct
7 Correct 22 ms 348 KB Output is correct
8 Correct 22 ms 348 KB Output is correct
9 Incorrect 13 ms 1624 KB Output isn't correct
10 Halted 0 ms 0 KB -