Submission #947479

# Submission time Handle Problem Language Result Execution time Memory
947479 2024-03-16T09:07:37 Z dilanyan Intergalactic ship (IZhO19_xorsum) C++17
17 / 100
2000 ms 1628 KB
//-------------dilanyan------------\\ 
 
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
 
//------------------KarginDefines--------------------\\ 
 
#define ll long long
#define pb push_back
#define all(u) (u).begin(), (u).end()
#define pqueue priority_queue
#define upper upper_bound
#define lower lower_bound
#define umap unordered_map
#define uset unordered_set
#define Kargin ios_base::sync_with_stdio(false);cin.tie(NULL);
#define Usaco freopen(".in", "r", stdin); freopen(".out", "w", stdout);
 
 
//-------------------KarginConstants------------------\\ 
 
const ll mod = 1000000007;
const ll inf = 1e9 + 15;
 
//-------------------KarginCode------------------------\\ 
 
const int N = 1005,M = 100005;
ll a[N];

struct query {
    int l, r, x;
};

query q[M];


void KarginSolve() {
    int n; cin >> n;
    for (int i = 0;i < n;i++) cin >> a[i];
    int m; cin >> m;
    for (int i = 0;i < m;i++) {
        cin >> q[i].l >> q[i].r >> q[i].x;
        q[i].l--;
    }
    ll ans = 0;
    for (int mask = 0;mask < (1 << m);mask++) {
        for (int j = 0;j < m;j++) {
            if (mask & (1 << j)) {
                for (int i = q[j].l;i < q[j].r;i++) a[i] ^= q[j].x;
            }
        }
        for (int i = 0;i < n;i++) {
            ll sum = 0;
            for (int j = i;j < n;j++) {
                sum += a[j];
                ans += (sum * sum) % mod;
                ans %= mod;
            }
        }
        for (int j = 0;j < m;j++) {
            if (mask & (1 << j)) {
                for (int i = q[j].l;i < q[j].r;i++) a[i] ^= q[j].x;
            }
        }
    }
    cout << ans << '\n';
}
 
int main() {
    Kargin;
    int test = 1;
    //cin >> test;
    while (test--) {
        KarginSolve();
    }
    return 0;
}

Compilation message

xorsum.cpp:1:1: warning: multi-line comment [-Wcomment]
    1 | //-------------dilanyan------------\\
      | ^
xorsum.cpp:8:1: warning: multi-line comment [-Wcomment]
    8 | //------------------KarginDefines--------------------\\
      | ^
xorsum.cpp:22:1: warning: multi-line comment [-Wcomment]
   22 | //-------------------KarginConstants------------------\\
      | ^
xorsum.cpp:27:1: warning: multi-line comment [-Wcomment]
   27 | //-------------------KarginCode------------------------\\
      | ^
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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 17 ms 348 KB Output is correct
7 Correct 17 ms 348 KB Output is correct
8 Correct 17 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 1628 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2037 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1746 ms 440 KB Output is correct
2 Correct 1762 ms 444 KB Output is correct
3 Correct 1742 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1746 ms 440 KB Output is correct
2 Correct 1762 ms 444 KB Output is correct
3 Correct 1742 ms 592 KB Output is correct
4 Incorrect 8 ms 344 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 17 ms 348 KB Output is correct
7 Correct 17 ms 348 KB Output is correct
8 Correct 17 ms 348 KB Output is correct
9 Correct 1746 ms 440 KB Output is correct
10 Correct 1762 ms 444 KB Output is correct
11 Correct 1742 ms 592 KB Output is correct
12 Incorrect 77 ms 448 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 17 ms 348 KB Output is correct
7 Correct 17 ms 348 KB Output is correct
8 Correct 17 ms 348 KB Output is correct
9 Correct 1746 ms 440 KB Output is correct
10 Correct 1762 ms 444 KB Output is correct
11 Correct 1742 ms 592 KB Output is correct
12 Incorrect 8 ms 344 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 17 ms 348 KB Output is correct
7 Correct 17 ms 348 KB Output is correct
8 Correct 17 ms 348 KB Output is correct
9 Incorrect 13 ms 1628 KB Output isn't correct
10 Halted 0 ms 0 KB -