Submission #1370017

#TimeUsernameProblemLanguageResultExecution timeMemory
1370017kawhietSegments (IZhO18_segments)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 47
#endif

array<int, 2> get(array<int, 2> x, array<int, 2> y) {
    return {max(x[0], y[0]), min(x[1], y[1])};
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, t;
    cin >> n >> t;
    map<int, array<int, 2>> m;
    int id = 1, ans = 0;
    while (n--) {
        int c;
        cin >> c;
        if (c == 1) {
            int a, b;
            cin >> a >> b;
            int l = a ^ (t * ans);
            int r = b ^ (t * ans);
            if (l > r) swap(l, r);
            m[id] = {l, r};
            id++;
        } else if (c == 2) {
            int i;
            cin >> i;
            m.erase(i);
        } else {
            int a, b, k;
            cin >> a >> b >> k;
            int l = a ^ (t * ans);
            int r = b ^ (t * ans);
            if (l > r) swap(l, r);
            int ans_nw = 0;
            for (auto [i1, x] : m) {
                array<int, 2> z = get({l, r}, x);
                if (z[1] - z[0] + 1 >= k) {
                    ans_nw++;
                }
            }
            swap(ans, ans_nw);
            cout << ans << '\n';
        }

    }

Compilation message (stderr)

segments.cpp: In function 'int main()':
segments.cpp:53:6: error: expected '}' at end of input
   53 |     }
      |      ^
segments.cpp:14:12: note: to match this '{'
   14 | int main() {
      |            ^