Submission #950325

# Submission time Handle Problem Language Result Execution time Memory
950325 2024-03-20T08:16:13 Z Trisanu_Das Editor (BOI15_edi) C++17
0 / 100
36 ms 6616 KB
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
using namespace std;
const int MAXN = 300010, LOG=18;
 
int n, x, ans[MAXN], par[MAXN], mn[MAXN];
 
int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++){
		cin >> x;
		if (x){
			par[i]=i;
			ans[i]=x;
		}
		else{
			mn[i] = x =- x;
			int v = i - 1;
			while (mn[v] >= x) v = par[v];
			par[i] = v - 1;
			ans[i] = ans[par[i]];
		}
		cout << ans[i] << '\n';
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB Integer -21 violates the range [0, 30]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 6616 KB Integer -1 violates the range [0, 300000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 4956 KB Integer -124579 violates the range [0, 150000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB Integer -21 violates the range [0, 30]
2 Halted 0 ms 0 KB -