# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1054375 |
2024-08-12T09:12:20 Z |
김은성(#11056) |
Koala Game (APIO17_koala) |
C++14 |
|
33 ms |
600 KB |
#include "koala.h"
#include <bits/stdc++.h>
using namespace std;
int minValue(int N, int W) {
/*int b[100], r[100];
int i;
for(i=0; i<N-1; i++)
b[i] = 0;
b[N-1] = 1;
playRound(b, r);
for(i=0; i<N-1; i++){
if(r[i] == 0)
return i;
}*/
return N-1;
}
int maxValue(int N, int W) {
// TODO: Implement Subtask 2 solution here.
// You may leave this function unmodified if you are not attempting this
// subtask.
return 0;
}
int greaterValue(int N, int W) {
int lo = 1, hi = 15, mid, i;
int b[100], r[100];
while(lo <= hi){
mid = (lo+hi)/2;
for(i=0; i<N; i++)
b[i] = 0;
b[0] = b[1] = mid;
playRound(b, r);
bool ch0 = (r[0] > mid), ch1 = (r[1] > mid);
//printf("mid=%d ch0=%d ch1=%d\n", mid, ch0, ch1);
if(ch0 && ch1)
lo = mid+1;
else if(!ch0 && !ch1)
hi = mid-1;
else{
if(ch0)
return 0;
else
return 1;
}
}
assert(0);
return 0;
}
int greater2(int N, int W, int p1, int p2){
int lo = 1, hi = 15, mid, i;
int b[100], r[100];
while(lo <= hi){
mid = (lo+hi)/2;
for(i=0; i<N; i++)
b[i] = 0;
b[0] = b[1] = mid;
playRound(b, r);
bool ch0 = (r[p1] > mid), ch1 = (r[p2] > mid);
//printf("mid=%d ch0=%d ch1=%d\n", mid, ch0, ch1);
if(ch0 && ch1)
lo = mid+1;
else if(!ch0 && !ch1)
hi = mid-1;
else{
if(ch0)
return 0;
else
return 1;
}
}
assert(0);
return 0;
}
int ans[109];
void mergesort(int n, int w, int l, int r){
if(l==r)
return;
int mid = (l+r)/2;
mergesort(n, w, l, mid);
mergesort(n, w, mid+1, r);
vector<int> vec;
int p1 = l, p2 = mid+1;
while(p1 <= mid && p2 <= r){
if(greater2(n, w, ans[p1], ans[p2]) == 0)
vec.push_back(ans[p1++]);
else
vec.push_back(ans[p2++]);
}
while(p1 <= mid)
vec.push_back(ans[p1++]);
while(p2 <= r)
vec.push_back(ans[p2++]);
int i;
for(i=l; i<=r; i++){
ans[i] = vec[i-l];
}
}
void allValues(int N, int W, int *P) {
int i;
for(i=0; i<N; i++)
ans[i] = i;
mergesort(N, W, 0, N-1);
for(i=0; i<N; i++)
P[ans[i]] = i+1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
484 KB |
Output is correct |
2 |
Partially correct |
33 ms |
344 KB |
Output is partially correct |
3 |
Correct |
28 ms |
344 KB |
Output is correct |
4 |
Correct |
28 ms |
344 KB |
Output is correct |
5 |
Partially correct |
26 ms |
344 KB |
Output is partially correct |
6 |
Correct |
26 ms |
344 KB |
Output is correct |
7 |
Partially correct |
28 ms |
344 KB |
Output is partially correct |
8 |
Correct |
26 ms |
344 KB |
Output is correct |
9 |
Correct |
27 ms |
344 KB |
Output is correct |
10 |
Correct |
29 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |