제출 #334859

#제출 시각아이디문제언어결과실행 시간메모리
334859juggernautSegments (IZhO18_segments)C++14
7 / 100
44 ms492 KiB
#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);
        }
    }
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...