답안 #992875

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
992875 2024-06-05T08:02:11 Z n3rm1n Intergalactic ship (IZhO19_xorsum) C++17
0 / 100
2000 ms 348 KB
#include<bits/stdc++.h>
#define endl '\n'
#define ll long long
using namespace std;
const int MAXN = 500;
void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
int n, m;
int a[MAXN], aa[MAXN];
int ql[MAXN], qr[MAXN], xx[MAXN];
long long mod = 1e9 + 7, total = 0;
void apply(int subset)
{
    for (int i = 1; i <= n; ++ i)
        aa[i] = a[i];
    for (int i = 0; i < m; ++ i)
    {
        if((1 << i) & subset)
        {
            for (int j = ql[i]; j <= qr[i]; ++ j)
                aa[i] = (aa[i] ^ xx[i]);

        }
    }
    long long ans = 0;
    for (int i = 1; i <= n; ++ i)
    {
        long long current = 0;
        for (int j = i; j <= n; ++ j)
        {
            current += a[j];
            current %= mod;
            ans += current * current;
            ans %= mod;
        }
    }
    total += ans;
    total %= mod;
}
void read()
{
    cin >> n;
    for (int i = 1; i <= n; ++ i)
    {
        cin >> a[i];
    }
    long long pow = 1;
    cin >> m;
    for (int i = 0; i < m; ++ i)
    {
        pow *= 2;
        cin >> ql[i] >> qr[i] >> xx[i];
    }
    for (int i = 0; i < pow; ++ i)
    {
        apply(i);
    }
    cout << total << endl;
}
int main()
{
    speed();
    read();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 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 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2065 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2047 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2045 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2045 ms 348 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 Incorrect 1 ms 348 KB Output isn't correct
4 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 Incorrect 1 ms 348 KB Output isn't correct
4 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 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -