Submission #61790719
Source Code Expand
Copy
#include<bits/stdc++.h>#define int long long#define f(i,j,n) for(int i=j;i<=n;i++)#define F(i,n,j) for(int i=n;i>=j;i--)#define updmax(a,b) a=max(a,b)#define updmin(a,b) a=min(a,b)#define pb push_back#define XQZusing namespace std;namespace fsd{#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,MAXSIZE,stdin),p1==p2)?EOF:*p1++)const int MAXSIZE=1<<20;char buf[MAXSIZE],*p1,*p2;inline int read(){int ak=0,ioi=1;char c=gc();while(!isdigit(c)){if(c=='-')ioi=-1;c=gc();}while(isdigit(c))ak=ak*10+(c^48),c=gc();return ak*ioi;}inline string reads(){string o="";
#include<bits/stdc++.h> #define int long long #define f(i,j,n) for(int i=j;i<=n;i++) #define F(i,n,j) for(int i=n;i>=j;i--) #define updmax(a,b) a=max(a,b) #define updmin(a,b) a=min(a,b) #define pb push_back #define XQZ using namespace std; namespace fsd{ #define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,MAXSIZE,stdin),p1==p2)?EOF:*p1++) const int MAXSIZE=1<<20; char buf[MAXSIZE],*p1,*p2; inline int read(){ int ak=0,ioi=1;char c=gc(); while(!isdigit(c)){if(c=='-')ioi=-1;c=gc();} while(isdigit(c))ak=ak*10+(c^48),c=gc(); return ak*ioi; } inline string reads(){ string o=""; char p=gc(); while(p>'z'||p<'a'){p=gc();} while(p<='z'&&p>='a'){o+=p;p=gc();} return o; } inline char readc(){ char p=gc(); while(!((p<='z'&&p>='a')||(p<='Z'&&p>='A'))){p=gc();} return p; } inline long double readd(){ long double ak=0;int ioi=1;char c=gc(); while(!isdigit(c)){if(c=='-')ioi=-1;c=gc();} while(isdigit(c))ak*=10,ak+=c-'0',c=gc(); c=gc(); long double q=0.1; while(isdigit(c))ak+=(c-'0')*q,q*=0.1,c=gc(); return ak*ioi; } } using namespace fsd; int s[300010],t,b; void gs(){ int q=read(); f(i,1,q){ int opt=read(),x; if(opt==1){ x=read(); s[b+1]=s[b]+x; b++; }else if(opt==2){ t++; }else{ x=read(); cout<<s[x-1+t]-s[t]<<endl; } } } signed main(){ #ifndef XQZ freopen(".in","r",stdin); freopen(".out","w",stdout); #endif #ifdef NXD int t=0;cin>>t;while(t--) #endif gs(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Snake Queue |
User | xiangqizhen |
Language | C++ 17 (Clang 16.0.6) |
Score | 300 |
Code Size | 1522 Byte |
Status | AC |
Exec Time | 155 ms |
Memory | 6992 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 02_min_00.txt, 02_min_01.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 1 ms | 3484 KB |
00_sample_01.txt | AC | 1 ms | 3400 KB |
00_sample_02.txt | AC | 1 ms | 3492 KB |
01_test_00.txt | AC | 1 ms | 3572 KB |
01_test_01.txt | AC | 2 ms | 3424 KB |
01_test_02.txt | AC | 3 ms | 3504 KB |
01_test_03.txt | AC | 3 ms | 3512 KB |
01_test_04.txt | AC | 1 ms | 3512 KB |
01_test_05.txt | AC | 4 ms | 3560 KB |
01_test_06.txt | AC | 151 ms | 5388 KB |
01_test_07.txt | AC | 74 ms | 4824 KB |
01_test_08.txt | AC | 151 ms | 5316 KB |
01_test_09.txt | AC | 132 ms | 5300 KB |
01_test_10.txt | AC | 152 ms | 5352 KB |
01_test_11.txt | AC | 61 ms | 4904 KB |
01_test_12.txt | AC | 152 ms | 5408 KB |
01_test_13.txt | AC | 58 ms | 4716 KB |
01_test_14.txt | AC | 152 ms | 5412 KB |
01_test_15.txt | AC | 101 ms | 5292 KB |
01_test_16.txt | AC | 98 ms | 5236 KB |
01_test_17.txt | AC | 99 ms | 5316 KB |
01_test_18.txt | AC | 55 ms | 6216 KB |
01_test_19.txt | AC | 53 ms | 6048 KB |
01_test_20.txt | AC | 53 ms | 6088 KB |
01_test_21.txt | AC | 53 ms | 6072 KB |
01_test_22.txt | AC | 147 ms | 5760 KB |
01_test_23.txt | AC | 155 ms | 5640 KB |
01_test_24.txt | AC | 8 ms | 6992 KB |
01_test_25.txt | AC | 4 ms | 6928 KB |
01_test_26.txt | AC | 7 ms | 6740 KB |
01_test_27.txt | AC | 5 ms | 5660 KB |
02_min_00.txt | AC | 1 ms | 3428 KB |
02_min_01.txt | AC | 1 ms | 3440 KB |