64142023-11-28 17:26:13horvathabelTitkos sorozatcpp17Runtime error 0/40229ms14920 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	vector<int> ans;
	ans.resize(n+1,0);
	deque<int> q;
	for (int i=1; i<=n;i++) q.push_back(i);
	for (int i=1; i<=n;i++){
		int x;
		cin>>x;
		if (ans[i]!=0) cout<<ans[i]<<" ";
		else{
			if (x==-1){
				cout<<q.back()<<" ";
				q.pop_back();
			}
		}
		if (x!=-1 && ans[i]==0){
			cout<<q.front()<<" ";
			q.pop_front();
			ans[x]=q.front();
			q.pop_front();
		}
	}

}
SubtaskSumTestVerdictTimeMemory
base0/40
1Accepted0/03ms1936 KiB
2Runtime error0/097ms3336 KiB
3Wrong answer0/13ms2632 KiB
4Wrong answer0/13ms2872 KiB
5Wrong answer0/23ms2980 KiB
6Runtime error0/14ms3308 KiB
7Runtime error0/14ms3556 KiB
8Runtime error0/24ms3792 KiB
9Runtime error0/2119ms6200 KiB
10Runtime error0/2120ms7024 KiB
11Runtime error0/2204ms7712 KiB
12Runtime error0/2119ms8180 KiB
13Runtime error0/2216ms8904 KiB
14Runtime error0/2202ms9404 KiB
15Runtime error0/2122ms9872 KiB
16Runtime error0/3120ms10412 KiB
17Runtime error0/3209ms11140 KiB
18Runtime error0/3125ms11856 KiB
19Runtime error0/3125ms12300 KiB
20Runtime error0/3229ms13136 KiB
21Runtime error0/1120ms13744 KiB
22Runtime error0/1119ms14428 KiB
23Runtime error0/1119ms14920 KiB