Submission #766139

# Submission time Handle Problem Language Result Execution time Memory
766139 2023-06-25T10:34:37 Z bachhoangxuan 라멘 (JOI14_ramen) C++17
100 / 100
1 ms 300 KB
#include "ramen.h"
#include<bits/stdc++.h>
using namespace std;

void Ramen(int n) {
    vector<int> Min,Max;
    for(int i=0;i<n;i+=2){
        if(i==n-1){Min.push_back(i);Max.push_back(i);}
        else{
            int c=Compare(i,i+1);
            if(c==-1){Max.push_back(i+1);Min.push_back(i);}
            else{Max.push_back(i);Min.push_back(i+1);}
        }
    }
    int x=Max[0],y=Min[0];
    for(int i=1;i<(int)Max.size();i++){
        int cx=Compare(x,Max[i]),cy=Compare(y,Min[i]);
        if(cx==-1) swap(x,Max[i]);
        if(cy==1) swap(y,Min[i]);
    }
    Answer(y,x);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 300 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct