Submission #966240

#TimeUsernameProblemLanguageResultExecution timeMemory
966240vjudge1XORanges (eJOI19_xoranges)C++17
0 / 100
66 ms7408 KiB
#include <bits/stdc++.h> using namespace std; #define fii(i,a,b) for(int i = a; i <= b; i++) #define fid(i,a,b) for(int i = a; i >= b; i--) #define ll long long #define fi first #define se second #define pii pair< int, int > #define pll pair< long long , long long > #define sz(x) int(x.size()) #define faster ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); #define maxn 1000005 #define all(a) a.begin(), a.end() #define ins insert #define pb push_back #define Base 13 // #define int long long #define MOD 1000000007 #define endl '\n' #define fill(a,n) memset(a, n, sizeof(a)); #define re return #define name "file" ll a[maxn]; int main(){ if(fopen(name".INP","r")){ freopen(name".INP", "r", stdin); freopen(name".OUT", "w", stdout); } faster int n, q; cin >> n >> q; fii(i, 1, n) { cin >> a[i]; } fii(i, 1, q) { int t, l, u; cin >> t >> l >> u; if(t == 1) { a[l] = u; } else { if(u - l + 1 == 1) { cout << a[l] << endl; } else if(u - l + 1 == 2) { cout << 0 << endl; } else if(u - l + 1 == 3) { ll c = a[l] ^ a[u]; cout << c << '\n'; } else { ll c = a[l] ^ a[l + 1]; ll d = a[u] ^ a[u - 1]; ll ans = c ^ d; cout << ans << endl; } } } }

Compilation message (stderr)

xoranges.cpp: In function 'int main()':
xoranges.cpp:29:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |         freopen(name".INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
xoranges.cpp:30:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |         freopen(name".OUT", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...