Submission #334859

# Submission time Handle Problem Language Result Execution time Memory
334859 2020-12-10T05:44:51 Z juggernaut Segments (IZhO18_segments) C++14
7 / 100
44 ms 492 KB
#include<bits/stdc++.h>
using namespace std;
int q,timer,t,last;
pair<int,int>ar[5005];
bool bl[5005];
int main(){
    scanf("%d%d",&q,&t);
    while(q--){
        int type;
        scanf("%d",&type);
        if(type==1){
            int l,r,a,b;
            scanf("%d%d",&a,&b);
            l=(a^(t*last)),r=(b^(t*last));
            if(l>r)swap(l,r);
            ar[++timer]={l,r};
        }else if(type==2){
            int id;
            scanf("%d",&id);
            bl[id]=true;
        }else if(type==3){
            int a,b,l,r,k;
            scanf("%d%d%d",&a,&b,&k);
            l=(a^(t*last)),r=(b^(t*last));
            if(l>r)swap(l,r);
            last=0;
            for(int i=1;i<=timer;i++){
                if(bl[i])continue;
                if(r<ar[i].first||ar[i].second<l)continue;
                if(min(r,ar[i].second)-max(l,ar[i].first)+1>=k)last++;
            }
            printf("%d\n",last);
        }
    }
}

Compilation message

segments.cpp: In function 'int main()':
segments.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     scanf("%d%d",&q,&t);
      |     ~~~~~^~~~~~~~~~~~~~
segments.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |         scanf("%d",&type);
      |         ~~~~~^~~~~~~~~~~~
segments.cpp:13:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |             scanf("%d%d",&a,&b);
      |             ~~~~~^~~~~~~~~~~~~~
segments.cpp:19:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   19 |             scanf("%d",&id);
      |             ~~~~~^~~~~~~~~~
segments.cpp:23:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   23 |             scanf("%d%d%d",&a,&b,&k);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 4 ms 492 KB Output is correct
5 Correct 26 ms 492 KB Output is correct
6 Correct 33 ms 492 KB Output is correct
7 Correct 16 ms 492 KB Output is correct
8 Correct 20 ms 492 KB Output is correct
9 Correct 18 ms 492 KB Output is correct
10 Correct 8 ms 492 KB Output is correct
11 Correct 44 ms 492 KB Output is correct
12 Correct 44 ms 492 KB Output is correct
13 Correct 10 ms 492 KB Output is correct
14 Correct 20 ms 492 KB Output is correct
15 Correct 4 ms 492 KB Output is correct
16 Correct 5 ms 492 KB Output is correct
17 Correct 21 ms 492 KB Output is correct
18 Correct 13 ms 492 KB Output is correct
19 Correct 19 ms 492 KB Output is correct
20 Correct 19 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 25 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 22 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 4 ms 492 KB Output is correct
5 Correct 26 ms 492 KB Output is correct
6 Correct 33 ms 492 KB Output is correct
7 Correct 16 ms 492 KB Output is correct
8 Correct 20 ms 492 KB Output is correct
9 Correct 18 ms 492 KB Output is correct
10 Correct 8 ms 492 KB Output is correct
11 Correct 44 ms 492 KB Output is correct
12 Correct 44 ms 492 KB Output is correct
13 Correct 10 ms 492 KB Output is correct
14 Correct 20 ms 492 KB Output is correct
15 Correct 4 ms 492 KB Output is correct
16 Correct 5 ms 492 KB Output is correct
17 Correct 21 ms 492 KB Output is correct
18 Correct 13 ms 492 KB Output is correct
19 Correct 19 ms 492 KB Output is correct
20 Correct 19 ms 492 KB Output is correct
21 Runtime error 3 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 4 ms 364 KB Output is correct
4 Correct 4 ms 492 KB Output is correct
5 Correct 26 ms 492 KB Output is correct
6 Correct 33 ms 492 KB Output is correct
7 Correct 16 ms 492 KB Output is correct
8 Correct 20 ms 492 KB Output is correct
9 Correct 18 ms 492 KB Output is correct
10 Correct 8 ms 492 KB Output is correct
11 Correct 44 ms 492 KB Output is correct
12 Correct 44 ms 492 KB Output is correct
13 Correct 10 ms 492 KB Output is correct
14 Correct 20 ms 492 KB Output is correct
15 Correct 4 ms 492 KB Output is correct
16 Correct 5 ms 492 KB Output is correct
17 Correct 21 ms 492 KB Output is correct
18 Correct 13 ms 492 KB Output is correct
19 Correct 19 ms 492 KB Output is correct
20 Correct 19 ms 492 KB Output is correct
21 Runtime error 3 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Halted 0 ms 0 KB -