이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma optimize("g", on)
#pragma GCC optimize ("inline")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("03")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,avx2,mmx,fma,avx,tune=native")
void Freopen () {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
using namespace std;
#define fi first
#define se second
#define int long long
const int N = 2e3 + 7;
void solve() {
int n, t;
cin>>n>>t;
vector<pair<int, int> > seg;
// vector<int> us(n + 1, 0);
int lst = 0, id = 0;
for(int _i = 0; _i < n; _i++) {
int ty, l, r, x;
cin>>ty;
if(ty == 1) {
cin>>l>>r;
l = (l ^ (t * lst)), r = (r ^ (t * lst));
if(l > r)swap(l, r);
++id;
seg.push_back({l, r});
}else if(ty == 2) {
cin>>x;
seg[x - 1] = {0, 0};
}else {
cin>>l>>r>>x;
l = (l ^ (t * lst)), r = (r ^ (t * lst));
if(l > r)swap(l, r);
int res = 0;
for(int i = 0; i < id; i++) {
int lx = max(l, seg[i].fi), rx = min(r, seg[i].se);
if((rx - lx + 1) >= x)res ++;
}
cout << res << '\n';
lst = res;
}
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
// Freopen();
int T = 1;
// cin>>T;
while(T --)solve();
}
/*
*/
컴파일 시 표준 에러 (stderr) 메시지
segments.cpp:2: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
2 | #pragma optimize("g", on)
|
segments.cpp: In function 'void Freopen()':
segments.cpp:10:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
10 | freopen("input.txt", "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
segments.cpp:11:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
11 | freopen("output.txt", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# | 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... |