답안 #859901

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
859901 2023-10-11T05:20:05 Z Alfraganus Intergalactic ship (IZhO19_xorsum) C++17
9 / 100
2000 ms 2260 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 ++){
        for(int j = 0; j < q; j ++){
            if((i & (1 << j))){
                for(int x = S[j].fs.fs; x <= S[j].fs.ss; x ++){
                    a[x] ^= S[j].ss;
                }
            }
        }
        for(int i = 0; i < n; i ++){
            int s = 0;
            for(int j = i; j < n; j ++){
                s = (s + a[j]) % mod;
                ans = (ans + s * s) % mod;
            }
        }
        for (int j = 0; j < q; j++)
        {
            if ((i & (1 << j)))
            {
                for (int x = S[j].fs.fs; x <= S[j].fs.ss; x++)
                {
                    a[x] ^= S[j].ss;
                }
            }
        }
    }
    cout << ans;
}

signed main()
{
    fastio int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
        cout << endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 22 ms 604 KB Output is correct
7 Correct 22 ms 344 KB Output is correct
8 Correct 23 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 15 ms 2260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2043 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2029 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2029 ms 344 KB Time limit exceeded
2 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 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 22 ms 604 KB Output is correct
7 Correct 22 ms 344 KB Output is correct
8 Correct 23 ms 348 KB Output is correct
9 Execution timed out 2029 ms 344 KB Time limit exceeded
10 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 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 22 ms 604 KB Output is correct
7 Correct 22 ms 344 KB Output is correct
8 Correct 23 ms 348 KB Output is correct
9 Execution timed out 2029 ms 344 KB Time limit exceeded
10 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 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 22 ms 604 KB Output is correct
7 Correct 22 ms 344 KB Output is correct
8 Correct 23 ms 348 KB Output is correct
9 Incorrect 15 ms 2260 KB Output isn't correct
10 Halted 0 ms 0 KB -