# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
975274 | canadavid1 | Editor (BOI15_edi) | C++14 | 3059 ms | 2292 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <queue>
#include <set>
int main()
{
int N;
std::cin >> N;
std::vector<int> a(N);
for(auto& i : a) std::cin >> i;
std::vector<int> which;
std::vector<bool> undone;
// for(auto i : a) std::cerr << i << "\t"; std::cerr << "\n";
for(auto op : a)
{
undone.push_back(0);
which.push_back(-1);
// for(auto i : undone) std::cerr << i << "\t"; std::cerr << "\n";
// for(auto i : which) std::cerr << i << "\t"; std::cerr << "\n";
if (op < 0)
{
op = -op;
int wh = which.size()-2;
while(-a[wh] >= op || undone[wh]) {wh--;}
// this is slow
which.back() = wh;
auto s = wh;
while(s > -1) {undone[s] = !undone[s]; s = which[s];} // pointer sequence but eh
// this is slow
}
int state = 0;
for(int i = 0; i < undone.size(); i++) if(!undone[i] && a[i] > 0) state = a[i];
// this is slow
std::cout << state << "\n";
}
}
/*
0 1 2 3 4 5
1 2 -1 -2 -3 -2
A U A
A A U A
A U A U A
A A U U A A
1 2 3 2
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |