답안 #638558

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
638558 2022-09-06T11:32:18 Z ShirleyM XORanges (eJOI19_xoranges) C++14
55 / 100
1000 ms 3272 KB
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
#define x first
#define y second
#define pb push_back
#define loop(i,s,e) for(int i=s;i<e;i++)
#define loopr(i,s,e) for(int i=e-1;i>=s;i--)
#define chkmax(a,b) a=max(a,b)
#define chkmin(a,b) a=min(a,b)
#define all(a) a.begin(),a.end()
#define fast {ios_base::sync_with_stdio(false); cin.tie(0);}
const int inf = 1e18;
const int INF = 1e9;
const int mod = 1e9+7;

int32_t main() {
    fast;
    int n,q; cin >> n >> q;
    vi a(n); loop(i,0,n) cin >> a[i];
    loop(i,0,q){
        int op; cin >> op;
        if(op==1){
            int ind, val; cin >> ind >> val;
            ind--;
            a[ind] = val;
        }
        else{
            int l,r; cin >> l >> r; l--; r--;
            int cur_xor_odd = 0;
            int ans = 0;
            if((r-l+1)%2 != 0) {
                loop(ind, l, r + 1) {
                    if ((ind - l) % 2 == 0) cur_xor_odd ^= a[ind];
                    ans ^= cur_xor_odd;
                }
            }
            cout << ans << endl;
        }
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 6 ms 468 KB Output is correct
12 Correct 7 ms 476 KB Output is correct
13 Correct 20 ms 592 KB Output is correct
14 Correct 17 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1060 ms 3272 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 6 ms 468 KB Output is correct
12 Correct 7 ms 476 KB Output is correct
13 Correct 20 ms 592 KB Output is correct
14 Correct 17 ms 468 KB Output is correct
15 Execution timed out 1060 ms 3272 KB Time limit exceeded
16 Halted 0 ms 0 KB -