이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define y1 theboatman
#define make_struct(args...) {args}
using namespace std;
struct osu {
int l, r, id;
};
void solve(int n, int t) {
vector <osu> now;
int id = 1, lastans;
for(int it = 0; it < n; it++) {
int type;
cin >> type;
if (type == 1) {
int a, b;
cin >> a >> b;
int l = (a ^ (t * lastans));
int r = (b ^ (t * lastans));
if (l > r) {
swap(l, r);
}
now.push_back(make_struct(l, r, id++));
}
if (type == 2) {
int id;
cin >> id;
vector <osu> new_now;
for(auto i : now) {
if (i.id != id) {
new_now.push_back(i);
}
}
now = new_now;
}
if (type == 3) {
int a, b, k;
cin >> a >> b >> k;
int l = (a ^ (t * lastans));
int r = (b ^ (t * lastans));
if (l > r) {
swap(l, r);
}
int res = 0;
for(auto i : now) {
int L = max(l, i.l);
int R = min(i.r, r);
if (!k) {
res++;
}
else {
if (L <= R && R - L + 1 >= k) {
res++;
}
}
}
cout << res << "\n";
lastans = res;
}
}
}
void solve1(int n, int t) {
cout << "kek\n";
}
int main() {
cin.tie(0);
ios :: sync_with_stdio(0);
int n, t;
cin >> n >> t;
if (n <= int(5e3)) {
solve(n, t);
}
else {
solve1(n, t);
}
return 0;
}
/*
*/
컴파일 시 표준 에러 (stderr) 메시지
segments.cpp: In function 'void solve(int, int)':
segments.cpp:52:29: warning: 'lastans' may be used uninitialized in this function [-Wmaybe-uninitialized]
int l = (a ^ (t * lastans));
~~~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |