Submission #459578

# Submission time Handle Problem Language Result Execution time Memory
459578 2021-08-08T17:02:04 Z BilAktauAlmansur XORanges (eJOI19_xoranges) C++17
55 / 100
1000 ms 3412 KB
#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 time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 2 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 12 ms 452 KB Output is correct
12 Correct 11 ms 460 KB Output is correct
13 Correct 36 ms 332 KB Output is correct
14 Correct 37 ms 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 3412 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 2 ms 204 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 12 ms 452 KB Output is correct
12 Correct 11 ms 460 KB Output is correct
13 Correct 36 ms 332 KB Output is correct
14 Correct 37 ms 444 KB Output is correct
15 Execution timed out 1082 ms 3412 KB Time limit exceeded
16 Halted 0 ms 0 KB -