Submission #947504

# Submission time Handle Problem Language Result Execution time Memory
947504 2024-03-16T10:05:59 Z asdfghjk XORanges (eJOI19_xoranges) C++17
30 / 100
25 ms 600 KB
/// tree bends in youth
/// 24.01.2024
/// success is doing same thing in every single day!!!
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(x) x.begin(), x.end()
#define F first
#define S second
using namespace std;
const ll N = 3e3 + 5;
const ll maxn =1e6 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ll LG = 18;
int a[N];
void solve(){
    int n,q;cin >> n >> q;
    if(max(n,q) <= 500){
        for(int i = 1;i <= n;i++){
            cin >> a[i];
        }
        while(q--){
            int tp;cin >> tp;
            if(tp == 1){
                int i,j;cin >> i >> j;
                a[i]  = j;
            }
            else{
                int l,r;cin >> l >> r;
                int ans = 0;
                for(int i = l;i <= r;i++){
                    int x = 0;
                    for(int j = i;j >= l;j--){
                        x = (x ^ a[j]);
                        ans = (ans ^ x);
                    }
                }
                cout << ans << '\n';
            }
        }
    }

}
main (){
    ios_base::sync_with_stdio(0);
    cin.tie(0);

//    freopen("haybales.in","r",stdin);
//    freopen("haybales.out","w",stdout);
    ll abd= 1;
//    cin >> abd;
    for(ll i = 1;i <= abd;i++){
//        cout << "Case " << i << ":\n";
        solve();
    }
}

Compilation message

xoranges.cpp:45:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   45 | main (){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 348 KB Output is correct
2 Correct 6 ms 348 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 25 ms 468 KB Output is correct
5 Correct 25 ms 476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 6 ms 348 KB Output is correct
7 Correct 6 ms 348 KB Output is correct
8 Correct 7 ms 344 KB Output is correct
9 Correct 25 ms 468 KB Output is correct
10 Correct 25 ms 476 KB Output is correct
11 Incorrect 0 ms 348 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 6 ms 348 KB Output is correct
7 Correct 6 ms 348 KB Output is correct
8 Correct 7 ms 344 KB Output is correct
9 Correct 25 ms 468 KB Output is correct
10 Correct 25 ms 476 KB Output is correct
11 Incorrect 0 ms 348 KB Output isn't correct
12 Halted 0 ms 0 KB -