Submission #937199

# Submission time Handle Problem Language Result Execution time Memory
937199 2024-03-03T15:53:22 Z Litusiano Fruits (NOI22_fruits) C++17
0 / 100
324 ms 25076 KB
#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 time Memory Grader output
1 Incorrect 0 ms 436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 231 ms 25076 KB Output is correct
2 Incorrect 324 ms 24604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 436 KB Output isn't correct
2 Halted 0 ms 0 KB -