# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1199553 | InvMOD | 라멘 (JOI14_ramen) | C++17 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
using namespace std;
void Ramen(int n){
int Mx = 0, Mn = 1;
if(Compare(0, 1) < 0) swap(Mx, Mn);
for(int i = 2; i < n; i += 2){
int j1 = i, j2 = i + 1;
if(Compare(j1, j2) < 0) swap(j1, j2);
if(Compare(j1, Mx) > 0) Mx = j1;
if(Compare(j2, Mn) < 0) Mn = j2;
}
if((n&1)){
if(Compare(n - 1, Mx) > 0) Mx = n - 1;
if(Compare(n - 1, Mn) < 0) Mn = n - 1;
}
Answer(Mn, Mx);
}