이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define sz(s) (int)s.size()
struct tp
{
int ff, ss, tt;
};
int f(int a, int b, int x, int y){
if(a > x) swap(a,x), swap(b,y);
if(b < x) return 0;
if(b <= y) return (b-x+1);
return (y-x+1);
}
int main(){
ios::sync_with_stdio(false); cin.tie(nullptr);
int n, t, ans = 0, ind = 0;
cin >> n >> t;
vector <tp> v;
for(int i = 1; i <= n; i++){
int t1;
cin >> t1;
if(t1 == 1){
int a, b;
cin >> a >> b;
ind++;
a = (a ^ (t * ans));
b = (b ^ (t * ans));
if(a > b) swap(a,b);
v.push_back({ind,a,b});
}
if(t1 == 2){
int id, in = 0;
cin >> id;
for(int j = 0; j < sz(v); j++){
if(v[j].ff == id){
in = j;
break;
}
}
v.erase(v.begin() + in);
}
if(t1 == 3){
int a, b, k;
cin >> a >> b >> k;
a = (a ^ (t * ans));
b = (b ^ (t * ans));
if(a > b) swap(a,b);
ans = 0;
for(int j = 0; j < sz(v); j++){
ans += (f(a,b,v[j].ss,v[j].tt) >= k);
}
cout << ans << '\n';
}
}
}
# | 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... |