Submission #23521

#TimeUsernameProblemLanguageResultExecution timeMemory
23521jjwdi0라멘 (JOI14_ramen)C++11
100 / 100
0 ms2028 KiB
#include "ramen.h" #include <bits/stdc++.h> using namespace std; vector<int> v1, v2; void Ramen(int N) { if(N == 1) Answer(0, 0); for(int i=0; i+1<N; i+=2) { if(Compare(i, i + 1) == 1) v1.push_back(i), v2.push_back(i + 1); else v1.push_back(i + 1), v2.push_back(i); } if(N % 2 == 1) { if(Compare(N - 1, 0) == 1) v1.push_back(N - 1); else v2.push_back(N - 1); } int X = v1[0], Y = v2[0]; for(int i=1; i<(int)v1.size(); i++) if(Compare(v1[i], X) == +1) X = v1[i]; for(int i=1; i<(int)v2.size(); i++) if(Compare(v2[i], Y) == -1) Y = v2[i]; Answer(Y, X); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...