Submission #1199557

#TimeUsernameProblemLanguageResultExecution timeMemory
1199557InvMOD라멘 (JOI14_ramen)C++17
100 / 100
0 ms328 KiB
#include<bits/stdc++.h>

using namespace std;

#include "ramen.h"

void Ramen(int n){
  if(n == 1) Answer(0, 0);
  int Mx = 0, Mn = 1;
  
  if(Compare(0, 1) < 0) swap(Mx, Mn);
  
  for(int i = 2; i + 1 < 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);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...