# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
104524 |
2019-04-07T12:00:07 Z |
tmk |
Koala Game (APIO17_koala) |
C++11 |
|
56 ms |
1272 KB |
#include<bits/stdc++.h>
#include"koala.h"
using namespace std;
#ifndef d
#define d(...)
#endif
#define st first
#define nd second
#define pb push_back
#define siz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
typedef long long LL;
typedef long double LD;
constexpr int INF=1e9+7;
constexpr LL INFL=1e18;
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
return os << "(" << P.st << "," << P.nd << ")";
}
template<typename T> ostream &operator <<(ostream& os, const vector<T>& V) {
os << "[";
for(auto& x:V)
os << x << ", ";
return os << "]";
}
int minValue(int N, int W) {
int *B = new int [N];
int *R = new int [N];
for(auto pt:{B, R})
fill_n(pt, N, 0);
B[0] = 1;
playRound(B, R);
if(R[0] == 2)
return find(R, R+N, 0) - R;
return 0;
}
int maxValue(int N, int W) {
int *B = new int [N];
int *R = new int [N];
auto reset = [&](int *t) {
fill_n(t, N, 0);
};
reset(B);
fill_n(B, N, 1);
playRound(B, R);
vector<int> pos;
for(int i=0; i<N; i++)
if(B[i] < R[i])
pos.push_back(i);
for(int _=0; _<3; _++) {
int x = W / pos.size();
reset(B);
for(auto p:pos)
B[p] = x;
playRound(B, R);
for(size_t i=0; i<pos.size();) {
auto& y = pos[i];
if(B[y] >= R[y]) {
y = pos.back();
pos.pop_back();
} else i++;
}
}
assert(pos.size() == 1);
return pos[0];
}
int greaterValue(int N, int W) {
int *B = new int [N];
int *R = new int [N];
auto reset = [&](int *t) {
fill_n(t, N, 0);
};
int l = 1, r = 10;
while(l != r) {
reset(B);
int s = (l + r) / 2;
B[0] = B[1] = s;
playRound(B, R);
if((B[0] < R[0]) != (B[1] < R[1]))
return int(B[1] < R[1]);
if(B[0] < R[0])
l = s+1;
else
r = s-1;
}
srand(1337 * l);
return rand() % 2;
}
void allValues(int N, int W, int *P) {
int *B = new int [N];
int *R = new int [N];
auto reset = [&](int *t) {
fill_n(t, N, 0);
};
if (W == 2*N) {
auto cmp = [&](int a, int b) {
reset(B);
B[a] = B[b] = W/2;
playRound(B, R);
return B[b] < R[b];
};
vector<int> ind(N);
iota(ind.begin(), ind.end(), 0);
stable_sort(ind.begin(), ind.end(), cmp);
for(int i=0; i<N; i++)
P[ind[i]] = i+1;
} else {
// TODO: Implement Subtask 5 solution here.
// You may leave this block unmodified if you are not attempting this
// subtask.
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
384 KB |
Output is correct |
3 |
Correct |
6 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
384 KB |
Output is correct |
2 |
Correct |
15 ms |
384 KB |
Output is correct |
3 |
Correct |
11 ms |
484 KB |
Output is correct |
4 |
Correct |
15 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
1272 KB |
Output is correct |
2 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
384 KB |
Output is correct |
2 |
Correct |
40 ms |
376 KB |
Output is correct |
3 |
Correct |
56 ms |
384 KB |
Output is correct |
4 |
Correct |
53 ms |
384 KB |
Output is correct |
5 |
Correct |
40 ms |
376 KB |
Output is correct |
6 |
Correct |
41 ms |
376 KB |
Output is correct |
7 |
Correct |
34 ms |
384 KB |
Output is correct |
8 |
Correct |
35 ms |
384 KB |
Output is correct |
9 |
Correct |
36 ms |
384 KB |
Output is correct |
10 |
Correct |
42 ms |
376 KB |
Output is correct |
11 |
Correct |
36 ms |
384 KB |
Output is correct |
12 |
Correct |
18 ms |
384 KB |
Output is correct |
13 |
Correct |
33 ms |
384 KB |
Output is correct |
14 |
Correct |
41 ms |
376 KB |
Output is correct |
15 |
Correct |
29 ms |
376 KB |
Output is correct |
16 |
Correct |
32 ms |
384 KB |
Output is correct |
17 |
Correct |
38 ms |
384 KB |
Output is correct |
18 |
Correct |
44 ms |
384 KB |
Output is correct |
19 |
Correct |
41 ms |
384 KB |
Output is correct |
20 |
Correct |
43 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |