답안 #331921

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
331921 2020-11-30T17:56:43 Z keko37 Intergalactic ship (IZhO19_xorsum) C++14
9 / 100
2000 ms 1516 KB
#include<bits/stdc++.h>

using namespace std;

const int MAXN = 1005;
const int MAXQ = 200005;
const int MOD = 1000000007;

int n, q;
int w[MAXN], lef[MAXQ], rig[MAXQ], val[MAXQ], sum[MAXN];

void upd (int mask) {
    for (int i = 0; i < q; i++) {
        if (mask & (1 << i)) {
            for (int pos = lef[i]; pos <= rig[i]; pos++) {
                w[pos] ^= val[i];
            }
        }
    }
}

int calc (int mask) {
    upd(mask);
    for (int i = 0; i < n; i++) {
        if (i == 0) sum[i] = w[i]; else sum[i] = sum[i - 1] + w[i];
    }
    int res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            int val = sum[j];
            if (i != 0) val -= sum[i - 1];
            res = (res + val * val) % MOD;
        }
    }
    upd(mask);
    return res;
}

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> w[i];
    }
    cin >> q;
    for (int i = 0; i < q; i++) {
        cin >> lef[i] >> rig[i] >> val[i];
        lef[i]--; rig[i]--;
    }
    int sol = 0;
    for (int mask = 0; mask < (1 << q); mask++) {
        sol = (sol + calc(mask)) % MOD;
    }
    cout << sol;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 23 ms 364 KB Output is correct
7 Correct 22 ms 364 KB Output is correct
8 Correct 23 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 1516 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2050 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2053 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2053 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 23 ms 364 KB Output is correct
7 Correct 22 ms 364 KB Output is correct
8 Correct 23 ms 364 KB Output is correct
9 Execution timed out 2053 ms 364 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 23 ms 364 KB Output is correct
7 Correct 22 ms 364 KB Output is correct
8 Correct 23 ms 364 KB Output is correct
9 Execution timed out 2053 ms 364 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 23 ms 364 KB Output is correct
7 Correct 22 ms 364 KB Output is correct
8 Correct 23 ms 364 KB Output is correct
9 Incorrect 20 ms 1516 KB Output isn't correct
10 Halted 0 ms 0 KB -