Submission #63551484
Source Code Expand
Copy
#include<bits/stdc++.h>using namespace std;#define int long long#define debug() cout<<"come on"<<'\n'#define mkp make_pair#define pb push_back#define ft first#define sd secondtypedef pair<int,int> pii;typedef pair<int,pii> piii;stack<int> st;int n;signed main(){cin>>n;for(int i=1;i<=n;i++){int type,x;cin>>type;if(type==1){cin>>x;st.push(x);}
#include<bits/stdc++.h> using namespace std; #define int long long #define debug() cout<<"come on"<<'\n' #define mkp make_pair #define pb push_back #define ft first #define sd second typedef pair<int,int> pii; typedef pair<int,pii> piii; stack<int> st; int n; signed main(){ cin>>n; for(int i=1;i<=n;i++){ int type,x; cin>>type; if(type==1){ cin>>x; st.push(x); } else{ if(st.empty()){ cout<<0<<'\n'; } else cout<<st.top()<<'\n',st.pop(); } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Card Pile |
User | dulf2024 |
Language | C++ 20 (gcc 12.2) |
Score | 200 |
Code Size | 520 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 3604 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 1 ms | 3600 KB |
00_sample_01.txt | AC | 1 ms | 3528 KB |
01_handmade_00.txt | AC | 1 ms | 3536 KB |
01_handmade_01.txt | AC | 1 ms | 3528 KB |
01_handmade_02.txt | AC | 1 ms | 3464 KB |
01_handmade_03.txt | AC | 1 ms | 3540 KB |
01_handmade_04.txt | AC | 1 ms | 3484 KB |
01_handmade_05.txt | AC | 1 ms | 3484 KB |
02_random_00.txt | AC | 1 ms | 3484 KB |
02_random_01.txt | AC | 1 ms | 3604 KB |
02_random_02.txt | AC | 1 ms | 3448 KB |
02_random_03.txt | AC | 1 ms | 3484 KB |
02_random_04.txt | AC | 1 ms | 3440 KB |
02_random_05.txt | AC | 1 ms | 3492 KB |
02_random_06.txt | AC | 1 ms | 3604 KB |
02_random_07.txt | AC | 1 ms | 3488 KB |
02_random_08.txt | AC | 1 ms | 3476 KB |
02_random_09.txt | AC | 1 ms | 3600 KB |
02_random_10.txt | AC | 1 ms | 3464 KB |
02_random_11.txt | AC | 1 ms | 3516 KB |
02_random_12.txt | AC | 1 ms | 3536 KB |
02_random_13.txt | AC | 1 ms | 3484 KB |
02_random_14.txt | AC | 1 ms | 3472 KB |