#include "ramen.h"
#include <bits/stdc++.h>
using namespace std;
void Ramen(int N) {
vector<int> mn_poss, mx_poss;
for (int i = 0; i < N - 1; i += 2) {
if (Compare(i, i + 1) == 1) {
mn_poss.push_back(i + 1);
mx_poss.push_back(i);
} else {
mn_poss.push_back(i);
mx_poss.push_back(i + 1);
}
}
if (N & 1) {
mn_poss.push_back(N - 1);
mx_poss.push_back(N - 1);
}
int best_mx = mx_poss.front();
for (int e : mx_poss) {
if (e == mx_poss.front()) continue;
if (Compare(e, best_mx) == 1)
best_mx = e;
}
int best_mn = mn_poss.front();
for (int e : mn_poss) {
if (e == mn_poss.front()) continue;
if (Compare(best_mn, e) == 1)
best_mn = e;
}
Answer(best_mn, best_mx);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
308 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |