Submission #937199

#TimeUsernameProblemLanguageResultExecution timeMemory
937199LitusianoFruits (NOI22_fruits)C++17
0 / 100
324 ms25076 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = 1e9; int main(){ int n; cin>>n; set<int> available; for(int i = 1; i<=n; i++) available.insert(i); vector<int> v(n); for(int& i : v) cin>>i; for(int i : v){ if(available.count(i)) available.erase(i); } available.insert(MAXN); int mx = 0; int ans = 0; for(int i = 0; i<n; i++){ if(v[i] == -1){ if(*available.upper_bound(mx) < MAXN){ ans++; int t = *available.upper_bound(mx); mx = t; available.erase(t); } } else{ if(v[i] > mx){ ans++; mx = v[i]; } } cout<<ans<<" "; } }
#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...