#include "koala.h"
#include<bits/stdc++.h>
#define lf double
#define ll long long
#define cc pair<char,char>
#define ull unsigned ll
#define ii pair<int,int>
#define li pair<ll,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define iiii2 pair<int,iii>
#define lii pair<ll,ii>
#define lolo pair<ll,ll>
#define heap priority_queue
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define all(x) x.begin(),x.end()
#define len(x) strlen(x)
#define sz(x) (int) x.size()
#define orta ((bas+son)/2)
#define min3(x,y,z) min(min(x,y),z)
#define max3(x,y,z) max(max(x,y),z)
#define umin(x,y) x=min(x,y)
#define umax(x,y) x=max(x,y)
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define MOD 1000000007
#define inf 4000000000000000000ll
#define M 10000002
#define LOG 20
#define magic 100
#define KOK 350
#define EPS 0.0025
#define pw(x) ((1ll)<<(x))
#define PI 3.1415926535
using namespace std;
int N,W;
int i1,i2=1;
int minValue(int N, int W) {
// TODO: Implement Subtask 1 solution here.
// You may leave this function unmodified if you are not attempting this
// subtask.
int R[105];
int B[105]={0};
B[0]=1;
playRound(B,R);
if(R[0]==1 || R[0]==0) {
return 0;
}
else {
for(int i=1;i<N;i++) if(!R[i]) return i;
}
}
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.
vector<int> v11,v12,v21,v22,v23,v24,v31,v32,v33,v34,v35,v36;
int B[105]={0};
int R[105];
for(int i=0;i<N;i++) B[i]=1;
playRound(B,R);
for(int i=0;i<N;i++) {
if(R[i]>=2) v12.pb(i);
else v11.pb(i);
}
for(int i:v12) B[i]=2;
for(int i:v11) B[i]=0;
playRound(B,R);
for(int i:v12) {
if(R[i]>=3) {
v24.pb(i);
}
else {
v23.pb(i);
}
}
for(int i:v11) {
if(R[i]>=1) {
v22.pb(i);
}
else {
v21.pb(i);
}
}
memset(B,0,sizeof(B));
for(int i:v23) B[i]=1;
for(int i:v24) B[i]=3;
playRound(B,R);
for(int i:v24) {
if(R[i]>=4) v36.pb(i);
else v35.pb(i);
}
for(int i:v23) {
v34.pb(i);
}
for(int i:v22) v33.pb(i);
for(int i:v21) {
if(R[i]>=1) v32.pb(i);
else v31.pb(i);
}
memset(B,0,sizeof(B));
for(int i:v36) B[i]=10;
playRound(B,R);
for(int i=0;i<N;i++) if(R[i]>=11) return i;
}
int greaterValue(int N, int W) {
// TODO: Implement Subtask 3 solution here.
// You may leave this function unmodified if you are not attempting this
// subtask.
int B[105]={0};
int R[105];
int bas=1,son=8;
memset(B,0,sizeof(B));
while(bas<=son) {
B[i1]=B[i2]=orta;
playRound(B,R);
int s1=(R[i1]>orta);
int s2=(R[i2]>orta);
if(s1&s2) {
bas=orta+1;
}
else if(!(s1^s2)) {
son=orta-1;
}
else {
if(s1) return 0;
return 1;
}
}
}
int doit(int x,int y) {i1=x;i2=y;return greaterValue(N,W);}
void solve(vector<int> &now) {
vector<int> l,r;
if(sz(now)<=1) return ;
for(int i=0;i<sz(now)/2;i++) l.pb(now[i]);
for(int i=sz(now)/2;i<sz(now);i++) r.pb(now[i]);
now.clear();
solve(l);
solve(r);
int b1=0,b2=0;
while(b1<sz(l) || b2<sz(r)) {
if(b1<sz(l) && (b2==sz(r) || (doit(l[b1],r[b2])))) {
now.pb(l[b1++]);
}
else {
now.pb(r[b2++]);
}
}
}
void allValues(int N, int W, int *P) {
if (W == 2*N) {
// TODO: Implement Subtask 4 solution here.
// You may leave this block unmodified if you are not attempting this
// subtask.
} else {
// TODO: Implement Subtask 5 solution here.
// You may leave this block unmodified if you are not attempting this
// subtask.
vector<int> all;
for(int i=0;i<N;i++) all.pb(i);
::N=N;
::W=W;
solve(all);
for(int i=0;i<N;i++) P[all[i]]=i+1;
}
}
Compilation message
koala.cpp: In function 'int minValue(int, int)':
koala.cpp:69:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
koala.cpp: In function 'int maxValue(int, int)':
koala.cpp:166:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
koala.cpp: In function 'int greaterValue(int, int)':
koala.cpp:207:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
288 KB |
Output is correct |
2 |
Correct |
11 ms |
504 KB |
Output is correct |
3 |
Correct |
8 ms |
524 KB |
Output is correct |
4 |
Correct |
7 ms |
624 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
624 KB |
Output is correct |
2 |
Correct |
22 ms |
624 KB |
Output is correct |
3 |
Correct |
18 ms |
624 KB |
Output is correct |
4 |
Correct |
19 ms |
660 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
98 ms |
816 KB |
Output is partially correct |
2 |
Partially correct |
110 ms |
920 KB |
Output is partially correct |
3 |
Partially correct |
106 ms |
920 KB |
Output is partially correct |
4 |
Partially correct |
107 ms |
920 KB |
Output is partially correct |
5 |
Partially correct |
85 ms |
920 KB |
Output is partially correct |
6 |
Partially correct |
111 ms |
920 KB |
Output is partially correct |
7 |
Partially correct |
94 ms |
920 KB |
Output is partially correct |
8 |
Partially correct |
102 ms |
920 KB |
Output is partially correct |
9 |
Partially correct |
94 ms |
920 KB |
Output is partially correct |
10 |
Partially correct |
92 ms |
920 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
920 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
25 ms |
920 KB |
Output is partially correct |
2 |
Partially correct |
62 ms |
920 KB |
Output is partially correct |
3 |
Partially correct |
60 ms |
920 KB |
Output is partially correct |
4 |
Partially correct |
45 ms |
920 KB |
Output is partially correct |
5 |
Partially correct |
41 ms |
920 KB |
Output is partially correct |
6 |
Partially correct |
54 ms |
920 KB |
Output is partially correct |
7 |
Partially correct |
40 ms |
920 KB |
Output is partially correct |
8 |
Partially correct |
40 ms |
920 KB |
Output is partially correct |
9 |
Partially correct |
45 ms |
920 KB |
Output is partially correct |
10 |
Partially correct |
65 ms |
920 KB |
Output is partially correct |
11 |
Partially correct |
58 ms |
920 KB |
Output is partially correct |
12 |
Partially correct |
30 ms |
920 KB |
Output is partially correct |
13 |
Partially correct |
60 ms |
920 KB |
Output is partially correct |
14 |
Partially correct |
44 ms |
920 KB |
Output is partially correct |
15 |
Partially correct |
62 ms |
920 KB |
Output is partially correct |
16 |
Partially correct |
44 ms |
920 KB |
Output is partially correct |
17 |
Partially correct |
46 ms |
920 KB |
Output is partially correct |
18 |
Partially correct |
48 ms |
920 KB |
Output is partially correct |
19 |
Partially correct |
48 ms |
920 KB |
Output is partially correct |
20 |
Partially correct |
41 ms |
920 KB |
Output is partially correct |
21 |
Partially correct |
45 ms |
920 KB |
Output is partially correct |
22 |
Partially correct |
53 ms |
920 KB |
Output is partially correct |
23 |
Partially correct |
49 ms |
920 KB |
Output is partially correct |
24 |
Partially correct |
44 ms |
920 KB |
Output is partially correct |
25 |
Partially correct |
44 ms |
920 KB |
Output is partially correct |
26 |
Partially correct |
44 ms |
920 KB |
Output is partially correct |
27 |
Partially correct |
43 ms |
920 KB |
Output is partially correct |
28 |
Partially correct |
42 ms |
920 KB |
Output is partially correct |
29 |
Partially correct |
42 ms |
920 KB |
Output is partially correct |
30 |
Partially correct |
46 ms |
920 KB |
Output is partially correct |
31 |
Partially correct |
59 ms |
920 KB |
Output is partially correct |
32 |
Partially correct |
43 ms |
920 KB |
Output is partially correct |
33 |
Partially correct |
46 ms |
920 KB |
Output is partially correct |
34 |
Partially correct |
41 ms |
920 KB |
Output is partially correct |
35 |
Partially correct |
46 ms |
920 KB |
Output is partially correct |
36 |
Partially correct |
62 ms |
920 KB |
Output is partially correct |
37 |
Partially correct |
48 ms |
920 KB |
Output is partially correct |
38 |
Partially correct |
40 ms |
920 KB |
Output is partially correct |
39 |
Partially correct |
38 ms |
920 KB |
Output is partially correct |
40 |
Partially correct |
42 ms |
920 KB |
Output is partially correct |