# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
787286 |
2023-07-19T03:38:09 Z |
vjudge1 |
Editor (BOI15_edi) |
C++14 |
|
3000 ms |
7072 KB |
#include <bits/stdc++.h>
using namespace std;
const int N = 3e5+7;
pair <char, int> op[N];
pair <int, int> link[N];
int n;
int main(){
cin >> n;
op[0] = {'E', 0};
link[0] = {1, 0};
for (int i = 1; i <= n; i++){
int w;
cin >> w;
if (w < 0){
op[i] = {'U', -w};
} else {
op[i] = {'E', w};
}
}
//cout << "\n";
for (int i = 1; i <= n; i++){
if (op[i].first == 'E'){
cout << op[i].second << "\n";
link[i] = {1, 0};
} else {
int lv = op[i].second;
for (int j = i-1; j >= 1; j--){
if (link[j].first == 1 && (op[j].first == 'E' || (op[j].first == 'U' && op[j].second < lv))){
link[i] = {1, j};
break;
}
}
int ptr = link[i].second, w = ptr;
while(ptr != 0){
//cout << ptr << ' ';
link[ptr].first = 1 - link[ptr].first;
//cout << link[ptr].first << "\n";
w = ptr;
ptr = link[ptr].second;
}
link[i].second = w;
//cout << "PTR\n";
for (int j = i; j >= 0; j--){
if (op[j].first == 'E' && link[j].first == 1){
cout << op[j].second << "\n";
break;
}
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
715 ms |
7072 KB |
Output is correct |
2 |
Correct |
818 ms |
6960 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3048 ms |
3408 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |