Submission #284053

#TimeUsernameProblemLanguageResultExecution timeMemory
284053Patrusheva_AnnaXORanges (eJOI19_xoranges)C++14
30 / 100
1085 ms1152 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")

#define ll long long
#define pb push_back
#define F first
#define S second
#define ull unsigned long long
#define pii pair < int, int >
#define ld long double


using namespace std;
using namespace __gnu_pbds;

mt19937 gen(time(0));
template <typename T>
using ordered_set=tree<T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
vector < int > X({-1, 1, -1, 1, 0, 0, -1, 1});
vector < int > Y({-1, 1, 0, 0, -1, 1, 1, -1});
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);


#ifdef LOCAL
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#else

#endif


    int n;
    cin >> n;
    int q;
    cin >> q;
    vector < int > a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    while (q--)
    {
        int z;
        cin >> z;
        if (z == 1)
        {
            int in, val;
            cin >> in >> val;
            a[in - 1] = val;
        }
        else
        {
            int l, r;
            cin >> l>> r;
            l--;
            r--;
            int ans = 0;
            for (int i = 0; i <= r - l + 1; i++)
                for (int j = l; j + i <= r; j++)
                for (int u = j; u <= j + i; u++)
                ans ^= a[u];

            cout << ans << "\n";

        }
    }







    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...