Submission #1168571

#TimeUsernameProblemLanguageResultExecution timeMemory
1168571SmuggingSpunXORanges (eJOI19_xoranges)C++20
55 / 100
19 ms328 KiB
#include<bits/stdc++.h>
#define taskname "A"
using namespace std;
int n, q;
namespace sub123{
    void solve(){
        vector<int>a(n + 1);
        for(int i = 1; i <= n; i++){
            cin >> a[i];
        }
        for(int _ = 0; _ < q; _++){
            int _t, u, v;
            cin >> _t >> u >> v;
            if(_t == 1){
                a[u] = v;
            }
            else{
                int ans = 0;
                for(int i = u; i <= v; i++){
                    if((~(i - u) & 1) && (~(v - i) & 1)){
                        ans ^= a[i];
                    }
                }
                cout << ans << "\n";
            }
        }
    }
}
namespace sub45{
    void solve(){

    }
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	if(fopen(taskname".inp", "r")){
		freopen(taskname".inp", "r", stdin);
	}
    cin >> n >> q;
    if(n <= 5000){
        sub123::solve();
    }
    else{
        sub45::solve();
    }
}

Compilation message (stderr)

xoranges.cpp: In function 'int main()':
xoranges.cpp:37:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...