답안 #1016534

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1016534 2024-07-08T07:50:15 Z Vanio Segments (IZhO18_segments) C++17
7 / 100
5000 ms 6876 KB
#include<bits/stdc++.h>
using namespace std;

struct segment{
    int l,r;
};
segment segments[200001];

int n,t,nextSegmentId,lastans;
set<int> segmentIds;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

int i,qt,l,r,id,k,ans;
cin>>n>>t;
while(n--){
    cin>>qt;
    if(qt==1){
        cin>>l>>r;
        l^=t*lastans;
        r^=t*lastans;
        if(l>r) swap(l,r);

        nextSegmentId++;
        segments[nextSegmentId].l=l;
        segments[nextSegmentId].r=r;
        segmentIds.insert(nextSegmentId);
    }
    else if(qt==2){
        cin>>id;
        segmentIds.erase(id);
    }
    else{
        cin>>l>>r>>k;
        l^=t*lastans;
        r^=t*lastans;
        if(l>r) swap(l,r);

        ans=0;
        for(auto it : segmentIds){
            if(min(r,segments[it].r)-max(l,segments[it].l)+1>=k) ans++;
        }
        cout<<ans<<'\n';
        lastans=ans;
    }
}










return 0;
}

Compilation message

segments.cpp: In function 'int main()':
segments.cpp:18:5: warning: unused variable 'i' [-Wunused-variable]
   18 | int i,qt,l,r,id,k,ans;
      |     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 20 ms 604 KB Output is correct
6 Correct 34 ms 792 KB Output is correct
7 Correct 6 ms 604 KB Output is correct
8 Correct 12 ms 728 KB Output is correct
9 Correct 11 ms 600 KB Output is correct
10 Correct 6 ms 604 KB Output is correct
11 Correct 35 ms 604 KB Output is correct
12 Correct 33 ms 604 KB Output is correct
13 Correct 7 ms 604 KB Output is correct
14 Correct 14 ms 708 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 580 KB Output is correct
17 Correct 11 ms 648 KB Output is correct
18 Correct 10 ms 604 KB Output is correct
19 Correct 9 ms 604 KB Output is correct
20 Correct 9 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5059 ms 4864 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 49 ms 2644 KB Output is correct
2 Correct 32 ms 2396 KB Output is correct
3 Correct 97 ms 2600 KB Output is correct
4 Correct 30 ms 2444 KB Output is correct
5 Execution timed out 5024 ms 6456 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 2640 KB Output is correct
2 Correct 37 ms 2644 KB Output is correct
3 Correct 46 ms 2700 KB Output is correct
4 Correct 36 ms 2828 KB Output is correct
5 Execution timed out 5068 ms 6876 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 20 ms 604 KB Output is correct
6 Correct 34 ms 792 KB Output is correct
7 Correct 6 ms 604 KB Output is correct
8 Correct 12 ms 728 KB Output is correct
9 Correct 11 ms 600 KB Output is correct
10 Correct 6 ms 604 KB Output is correct
11 Correct 35 ms 604 KB Output is correct
12 Correct 33 ms 604 KB Output is correct
13 Correct 7 ms 604 KB Output is correct
14 Correct 14 ms 708 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 580 KB Output is correct
17 Correct 11 ms 648 KB Output is correct
18 Correct 10 ms 604 KB Output is correct
19 Correct 9 ms 604 KB Output is correct
20 Correct 9 ms 604 KB Output is correct
21 Execution timed out 5059 ms 4864 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 20 ms 604 KB Output is correct
6 Correct 34 ms 792 KB Output is correct
7 Correct 6 ms 604 KB Output is correct
8 Correct 12 ms 728 KB Output is correct
9 Correct 11 ms 600 KB Output is correct
10 Correct 6 ms 604 KB Output is correct
11 Correct 35 ms 604 KB Output is correct
12 Correct 33 ms 604 KB Output is correct
13 Correct 7 ms 604 KB Output is correct
14 Correct 14 ms 708 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 580 KB Output is correct
17 Correct 11 ms 648 KB Output is correct
18 Correct 10 ms 604 KB Output is correct
19 Correct 9 ms 604 KB Output is correct
20 Correct 9 ms 604 KB Output is correct
21 Execution timed out 5059 ms 4864 KB Time limit exceeded
22 Halted 0 ms 0 KB -