제출 #1123883

#제출 시각아이디문제언어결과실행 시간메모리
1123883AvianshFruits (NOI22_fruits)C++17
0 / 100
254 ms25008 KiB
#include <bits/stdc++.h> using namespace std; signed main(){ ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int a[n],c[n]; for(int &i : a){ cin >> i; if(i!=-1){ i--; } } for(int &i : c){ cin >> i; } set<int>pos; for(int i = 0;i<n;i++){ pos.insert(i); } for(int i : a){ pos.erase(i); } set<int>::iterator it = pos.begin(); int currmx = -1; int ans = 0; for(int i = 0;i<n;i++){ if(a[i]==-1){ if(it!=pos.end()){ a[i]=*it; it++; ans++; } } else if(a[i]>currmx){ ans++; it=pos.lower_bound(a[i]); } currmx = max(currmx,a[i]); cout << ans << " "; } return 0; }
#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...