#include <bits/stdc++.h>
#define see(x) cerr<<#x<<"="<<x<<"\n";
using namespace std;
int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) {
vector <int> kn;
int ans = 0, pos = 0;
for (int i = 0; i < N; i ++) {
for (int j = 0; j < i; j ++) kn.push_back(K[j]);
kn.push_back(R);
for (int j = i; j < N - 1; j ++) kn.push_back(K[j]);
int cnt = 0;
for (int j = 0; j < C; j ++) {
// for (auto i: kn) cout << i << " ";
int mx = -1;
for (int k = S[j]; k <= E[j]; k ++) {
mx = max(mx, kn[k]);
}
// see(mx);
if (mx == R) cnt ++;
vector <int> tmp;
for (int k = 0; k < S[j]; k ++) tmp.push_back(kn[k]);
tmp.push_back(mx);
for (int k = E[j] + 1; k < int(kn.size()); k ++) tmp.push_back(kn[k]);
kn.clear();
for (auto i: tmp) kn.push_back(i);
}
// see(cnt);
if (ans < cnt) {
ans = cnt;
pos = i;
}
kn.clear();
}
return pos;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
4 ms |
300 KB |
Output is correct |
3 |
Correct |
291 ms |
296 KB |
Output is correct |
4 |
Correct |
304 ms |
304 KB |
Output is correct |
5 |
Correct |
28 ms |
212 KB |
Output is correct |
6 |
Correct |
300 ms |
296 KB |
Output is correct |
7 |
Correct |
310 ms |
300 KB |
Output is correct |
8 |
Correct |
298 ms |
304 KB |
Output is correct |
9 |
Correct |
4 ms |
300 KB |
Output is correct |
10 |
Correct |
47 ms |
300 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1099 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1089 ms |
2272 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |