Submission #59385

# Submission time Handle Problem Language Result Execution time Memory
59385 2018-07-21T22:51:40 Z duality Koala Game (APIO17_koala) C++11
48 / 100
135 ms 1016 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long int LLI;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
#include "koala.h"

int B[100],R[100];
int minValue(int N, int W) {
    int i;
    for (i = 0; i < N; i++) B[i] = 0;
    B[0] = 1;
    playRound(B,R);
    for (i = 0; i < N; i++) {
        if (R[i] == 0) return i;
    }
    return 0;
}

int maxValue(int N, int W) {
    int i;
    for (i = 0; i < N; i++) B[i] = 1;
    playRound(B,R);
    int c = 0;
    for (i = 0; i < N; i++) {
        if (R[i] == 2) B[i] = 2;
        else B[i] = 0;
    }
    playRound(B,R);
    for (i = 0; i < N; i++) {
        if (R[i] == 3) c++,B[i] = 4;
        else B[i] = 0;
    }
    playRound(B,R);
    for (i = 0; i < N; i++) {
        if (R[i] == 5) B[i] = 11;
        else B[i] = 0;
    }
    playRound(B,R);
    for (i = 0; i < N; i++) {
        if (R[i] == 12) return i;
    }
}

int compare(int a,int b,int N,int W) {
    int i,j;
    for (j = 0; j < N; j++) B[j] = 0;
    B[a] = B[b] = 1;
    playRound(B,R);
    if ((R[a] > 0) != (R[b] > 0)) return R[b] > 0;
    for (j = 0; j < N; j++) B[j] = 0;
    B[a] = B[b] = 11;
    playRound(B,R);
    if ((R[a] > 0) != (R[b] > 0)) return R[b] > 0;
    for (j = 0; j < N; j++) B[j] = 0;
    B[a] = B[b] = 3;
    playRound(B,R);
    if ((R[a] > 0) != (R[b] > 0)) return R[b] > 0;
    for (j = 0; j < N; j++) B[j] = 0;
    B[a] = B[b] = 6;
    playRound(B,R);
    if ((R[a] > 0) != (R[b] > 0)) return R[b] > 0;
    return -1;
}
int greaterValue(int N, int W) {
    return compare(0,1,N,W);
}

int n,w;
int inv[100];
bool comp(int a,int b) {
    if (a == b) return 0;
    else return compare(a,b,n,w);
}
void allValues(int N, int W, int *P) {
    n = N,w = W;
    if (W == 2*N) {
        // TODO: Implement Subtask 4 solution here.
        // You may leave this block unmodified if you are not attempting this
        // subtask.
    } else {
        int i;
        for (i = 0; i < N; i++) inv[i] = i;
        random_shuffle(inv,inv+N);
        sort(inv,inv+N,comp);
        for (i = 0; i < N; i++) P[inv[i]] = i+1;
    }
}

Compilation message

koala.cpp: In function 'int compare(int, int, int, int)':
koala.cpp:49:9: warning: unused variable 'i' [-Wunused-variable]
     int i,j;
         ^
koala.cpp: In function 'int maxValue(int, int)':
koala.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 8 ms 380 KB Output is correct
2 Correct 8 ms 460 KB Output is correct
3 Correct 9 ms 460 KB Output is correct
4 Correct 9 ms 508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 708 KB Output is correct
2 Correct 17 ms 708 KB Output is correct
3 Correct 20 ms 708 KB Output is correct
4 Correct 18 ms 708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 114 ms 712 KB Output is partially correct
2 Partially correct 113 ms 812 KB Output is partially correct
3 Partially correct 135 ms 832 KB Output is partially correct
4 Partially correct 116 ms 832 KB Output is partially correct
5 Partially correct 129 ms 1016 KB Output is partially correct
6 Partially correct 113 ms 1016 KB Output is partially correct
7 Partially correct 118 ms 1016 KB Output is partially correct
8 Partially correct 102 ms 1016 KB Output is partially correct
9 Partially correct 115 ms 1016 KB Output is partially correct
10 Partially correct 114 ms 1016 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1016 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 77 ms 1016 KB Output is partially correct
2 Partially correct 110 ms 1016 KB Output is partially correct
3 Partially correct 135 ms 1016 KB Output is partially correct
4 Partially correct 119 ms 1016 KB Output is partially correct
5 Partially correct 107 ms 1016 KB Output is partially correct
6 Partially correct 81 ms 1016 KB Output is partially correct
7 Partially correct 80 ms 1016 KB Output is partially correct
8 Partially correct 77 ms 1016 KB Output is partially correct
9 Partially correct 88 ms 1016 KB Output is partially correct
10 Partially correct 77 ms 1016 KB Output is partially correct
11 Partially correct 78 ms 1016 KB Output is partially correct
12 Partially correct 71 ms 1016 KB Output is partially correct
13 Partially correct 73 ms 1016 KB Output is partially correct
14 Partially correct 92 ms 1016 KB Output is partially correct
15 Partially correct 119 ms 1016 KB Output is partially correct
16 Partially correct 84 ms 1016 KB Output is partially correct
17 Partially correct 73 ms 1016 KB Output is partially correct
18 Partially correct 78 ms 1016 KB Output is partially correct
19 Partially correct 79 ms 1016 KB Output is partially correct
20 Partially correct 87 ms 1016 KB Output is partially correct
21 Partially correct 124 ms 1016 KB Output is partially correct
22 Partially correct 97 ms 1016 KB Output is partially correct
23 Partially correct 79 ms 1016 KB Output is partially correct
24 Partially correct 78 ms 1016 KB Output is partially correct
25 Partially correct 77 ms 1016 KB Output is partially correct
26 Partially correct 96 ms 1016 KB Output is partially correct
27 Partially correct 114 ms 1016 KB Output is partially correct
28 Partially correct 86 ms 1016 KB Output is partially correct
29 Partially correct 85 ms 1016 KB Output is partially correct
30 Partially correct 84 ms 1016 KB Output is partially correct
31 Partially correct 103 ms 1016 KB Output is partially correct
32 Partially correct 101 ms 1016 KB Output is partially correct
33 Partially correct 76 ms 1016 KB Output is partially correct
34 Partially correct 85 ms 1016 KB Output is partially correct
35 Partially correct 94 ms 1016 KB Output is partially correct
36 Partially correct 87 ms 1016 KB Output is partially correct
37 Partially correct 83 ms 1016 KB Output is partially correct
38 Partially correct 90 ms 1016 KB Output is partially correct
39 Partially correct 67 ms 1016 KB Output is partially correct
40 Partially correct 81 ms 1016 KB Output is partially correct