Submission #1348773

#TimeUsernameProblemLanguageResultExecution timeMemory
1348773Zone_zonee라멘 (JOI14_ramen)C++20
100 / 100
0 ms344 KiB
#include "ramen.h"
#include <bits/stdc++.h>

void Ramen(int N) {
    std::vector<int> hi, lo;
    for(int i = 0; i+1 < N; i += 2){
        if(Compare(i, i+1) == 1){
            hi.push_back(i);
            lo.push_back(i+1);
        }else{
            hi.push_back(i+1);
            lo.push_back(i);
        }
    }
    if(N&1){
        hi.push_back(N-1);
        lo.push_back(N-1);
    }
    int mx = hi.front(), mn = lo.front();
    for(int i = 1; i < hi.size(); ++i){
        if(Compare(mx, hi[i]) == -1) mx = hi[i];
    }
    for(int i = 1; i < lo.size(); ++i){
        if(Compare(mn, lo[i]) == 1) mn = lo[i];
    }
    Answer(mn, mx);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...