# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
42343 | minhtung0404 | 라멘 (JOI14_ramen) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef pair <int, int> ii;
ii solve(int l, int r){
if (l == r) return ii(l, l);
if (l + 1 == r){
if (Compare(l, r) == 1) return ii(r, l);
else return ii(l, r);
}
ii a = solve(l + 2, r), ans;
if (Compare(l, l+1) == 1) {
ans.first = l+1; ans.second = l;
}
else{
ans.first = l; ans.second = l+1;
}
if (Compare(ans.first, a.first) == 1) ans.first = a.first;
if (Compare(a.second, ans.second) == 1) ans.second = a.second;
return ans;
}
void Ramen(int N) {
ii a = solve(0, N-1);
Answer(a.first, a.second);
}