# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
423528 |
2021-06-11T08:47:20 Z |
송준혁(#7517) |
Monster Game (JOI21_monster) |
C++17 |
|
86 ms |
200 KB |
#include "monster.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define lb lower_bound
#define MOD 1000000007
#define INF (1ll<<62)
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
namespace {
int A[1010];
}
vector<int> Solve(int N) {
vector<int> ans(N);
for (int i=0; i<N; i++) A[i] = i;
for (int i=1; i<N; i++){
int lo=0, hi=i-1, k=i;
while (lo<=hi){
int m=lo+hi>>1;
if (Query(A[m], A[i])) k=m, hi=m-1;
else lo=m+1;
}
for (int j=i; j>k; j--) swap(A[j], A[j-1]);
}
int t=0;
for (int i=2; i<N; i++) if (Query(A[i], A[t])) reverse(A+t, A+i), t = i, i++;
if (Query(A[N-1], A[N-3])) reverse(A+t, A+N-1);
else reverse(A+t, A+N-1);
for (int i=0; i<N; i++) ans[A[i]] = i;
return ans;
}
Compilation message
monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:23:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
23 | int m=lo+hi>>1;
| ~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
200 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
86 ms |
200 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |