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 "ramen.h"
#include <vector>
using namespace std;
vector<int> mild, jin;
void Ramen(int N) {
for (int i=0; i<N/2; i++) {
if(Compare(2*i,2*i+1) == 1){
jin.push_back(2*i);
mild.push_back(2*i+1);
}
else{
mild.push_back(2*i);
jin.push_back(2*i+1);
}
}
if(N&1){
mild.push_back(N-1);
jin.push_back(N-1);
}
while (mild.size() > 1) {
if(Compare(mild.back(),mild[mild.size()-2]) == 1){
mild.pop_back();
}
else{
int t = mild.back();
mild.pop_back();
mild.pop_back();
mild.push_back(t);
}
}
while (jin.size() > 1){
if(Compare(jin.back(),jin[jin.size()-2]) == -1){
jin.pop_back();
}
else{
int t = mild.back();
jin.pop_back();
jin.pop_back();
jin.push_back(t);
}
}
Answer(jin.front(),mild.front());
}
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... |