Submission #3769620
Source Code Expand
#include<map> #include<iostream> #include<deque> #include<algorithm> #include<string> #include<cctype> #include<iomanip> #include<vector> #include<queue> #include<bitset> #include<random> #include<cstdint> using namespace std; #define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++) #define rep0(i,n) REP(i,0ll,n) #define rep1(i,n) REP(i,1ll,n+1) #define shosu setprecision(17) typedef long long ll; typedef pair<ll,ll> P; typedef pair<char,P> Q; ll longinf=(1ll<<60); ll inf=1ll<<29; int main(){ int n; cin>>n; P u[n]; rep0(i,n){ if(i==0) u[i]={1,0}; else u[i]={0,1}; } int m; cin>>m; rep0(i,m){ int x,y; cin>>x>>y; --x,--y; if(u[x].first+u[x].second<=1){ u[x]={0,0}; } else if(u[x].second>=1){ u[x].second--; } else{ u[x].first--; } u[y].first++; } int ans=0; rep0(i,n){ if(u[i].first>=1) ans++; } cout<<ans<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Box and Ball |
User | zunda1st |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1173 Byte |
Status | WA |
Exec Time | 72 ms |
Memory | 1792 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 1 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | WA | 1 ms | 256 KB |
1_00.txt | AC | 1 ms | 256 KB |
1_01.txt | AC | 1 ms | 256 KB |
1_02.txt | AC | 1 ms | 256 KB |
1_03.txt | AC | 1 ms | 256 KB |
1_04.txt | AC | 55 ms | 1792 KB |
1_05.txt | AC | 72 ms | 1792 KB |
1_06.txt | AC | 55 ms | 1024 KB |
1_07.txt | AC | 70 ms | 1024 KB |
1_08.txt | WA | 45 ms | 768 KB |
1_09.txt | WA | 46 ms | 1536 KB |
1_10.txt | WA | 15 ms | 1280 KB |
1_11.txt | WA | 26 ms | 512 KB |
1_12.txt | WA | 4 ms | 1664 KB |
1_13.txt | WA | 59 ms | 1280 KB |
1_14.txt | WA | 31 ms | 640 KB |
1_15.txt | WA | 52 ms | 512 KB |
1_16.txt | WA | 3 ms | 1152 KB |
1_17.txt | WA | 70 ms | 1792 KB |
1_18.txt | WA | 62 ms | 896 KB |
1_19.txt | WA | 68 ms | 640 KB |
1_20.txt | WA | 62 ms | 512 KB |
1_21.txt | WA | 55 ms | 896 KB |
1_22.txt | WA | 70 ms | 1152 KB |
1_23.txt | WA | 19 ms | 1280 KB |