Submission #459578

#TimeUsernameProblemLanguageResultExecution timeMemory
459578BilAktauAlmansurXORanges (eJOI19_xoranges)C++17
55 / 100
1082 ms3412 KiB
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <unordered_map> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #if __cplusplus >= 201103L #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_set> #endif using namespace std; #define vi vector<int> #define ll long long #define sz(s) (int)(s).size() #define all(v) (v).begin(), (v).end() #define F first #define S second #define run ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define ex exit(0); #define pb push_back const ll N = 3 * 1e5 + 1; vector<bool> resh(int n) { vector<bool>v(n + 1, false); for (int i = 3; i * i <= n; i += 2) { if (!v[i]) { for (int j = i * i; j <= n; j += i) { v[j] = true; } } }return v; } ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); }return a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int binpow(int a, int n) { int res = 1; while (n) { if (n & 1)res *= a; a *= a; n >>= 1; }return res; } int ei(int n) { int result = n; for (int i = 2; i * i <= n; i++)if (n % i == 0) { while (n % i == 0)n /= i; result -= result / i; }if (n > 1)result -= result / n; return result; } int an(int l, int r, vi& v) { int y = v[l]; for (int i = l + 1; i <= r; i++) { y = (int)y ^ v[i]; } return y; } int un(int l, int r, vi& v) { int x = 0; for (int i = l; i <= r; i++) { for (int j = i + 1; j <= r; j++) { if (i == r) { continue; } x = x ^ an(i, j, v); } } return (int)x; } void solve() { int n, q; cin >> n >> q; vi v(n); for (int i = 0; i < n; i++)cin >> v[i]; while (q--) { int ch, l, r; cin >> ch >> l >> r; if (ch == 1) { l--; v[l] = r; } else { l--, r--; int ans = 0; for (int i = l; i <= r; i++) { if (((i - l + 1) * (r - i + 1)) & 1) { ans ^= v[i]; } } cout << ans << endl; } } } signed main() { run; int t = 1; //cin >> t; while (t--)solve(); return 0; } /* */
#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...