답안 #255237

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
255237 2020-07-31T15:53:37 Z Osama_Alkhodairy 코알라 (APIO17_koala) C++17
44 / 100
82 ms 536 KB
#include <bits/stdc++.h>
#include "koala.h"
//~ #include "grader.cpp"
using namespace std;

int n;

bool cmp(int i, int j){
    int B[n], R[n];
    for(int i = 0 ; i < n ; i++){
        B[i] = R[i] = 0;
    }
    int l = 1, r = 9;
    while(l <= r){
        int mid = (l + r) / 2;
        B[i] = B[j] = mid;
        playRound(B, R);
        if((R[i] > B[i]) == (R[j] > B[j])){
            if(R[i] > B[j]) l = mid + 1;
            else r = mid - 1;
        }
        else return R[j] > B[j];
    }
    assert(false);
}
int minValue(int N, int W) {
    n = N;
    int B[n], R[n];
    for(int i = 0 ; i < n ; i++){
        B[i] = R[i] = 0;
    }
    B[0]++;
    playRound(B, R);
    for(int i = 0 ; i < n ; i++){
        if(B[i] >= R[i]) return i;
    }
    return 0;
}

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) {
    n = N;
    if(cmp(0, 1)) return 1;
    return 0;
}

void allValues(int N, int W, int *P) {
    n = N;
    if (W == 2*N) {
        // TODO: Implement Subtask 4 solution here.
        // You may leave this block unmodified if you are not attempting this
        // subtask.
    } else {
        vector <int> all;
        for(int i = 0 ; i < n ; i++){
            all.push_back(i);
        }
        sort(all.begin(), all.end(), cmp);
        for(int i = 0 ; i < n ; i++){
            P[all[i]] = i + 1;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 77 ms 384 KB Output is correct
2 Correct 82 ms 384 KB Output is correct
3 Correct 73 ms 536 KB Output is correct
4 Correct 71 ms 384 KB Output is correct
5 Correct 73 ms 384 KB Output is correct
6 Correct 77 ms 408 KB Output is correct
7 Correct 73 ms 384 KB Output is correct
8 Correct 74 ms 384 KB Output is correct
9 Correct 78 ms 396 KB Output is correct
10 Correct 73 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 41 ms 384 KB Output is partially correct
2 Partially correct 53 ms 384 KB Output is partially correct
3 Partially correct 48 ms 384 KB Output is partially correct
4 Partially correct 50 ms 504 KB Output is partially correct
5 Partially correct 56 ms 376 KB Output is partially correct
6 Partially correct 48 ms 384 KB Output is partially correct
7 Partially correct 50 ms 304 KB Output is partially correct
8 Partially correct 53 ms 384 KB Output is partially correct
9 Partially correct 53 ms 384 KB Output is partially correct
10 Partially correct 47 ms 504 KB Output is partially correct
11 Partially correct 50 ms 384 KB Output is partially correct
12 Partially correct 32 ms 384 KB Output is partially correct
13 Partially correct 51 ms 384 KB Output is partially correct
14 Partially correct 47 ms 384 KB Output is partially correct
15 Partially correct 46 ms 384 KB Output is partially correct
16 Partially correct 51 ms 504 KB Output is partially correct
17 Partially correct 56 ms 384 KB Output is partially correct
18 Partially correct 54 ms 384 KB Output is partially correct
19 Partially correct 47 ms 384 KB Output is partially correct
20 Partially correct 52 ms 376 KB Output is partially correct
21 Partially correct 57 ms 384 KB Output is partially correct
22 Partially correct 52 ms 384 KB Output is partially correct
23 Partially correct 40 ms 384 KB Output is partially correct
24 Partially correct 51 ms 384 KB Output is partially correct
25 Partially correct 52 ms 380 KB Output is partially correct
26 Partially correct 58 ms 384 KB Output is partially correct
27 Partially correct 51 ms 376 KB Output is partially correct
28 Partially correct 56 ms 376 KB Output is partially correct
29 Partially correct 50 ms 380 KB Output is partially correct
30 Partially correct 52 ms 384 KB Output is partially correct
31 Partially correct 49 ms 384 KB Output is partially correct
32 Partially correct 51 ms 384 KB Output is partially correct
33 Partially correct 53 ms 384 KB Output is partially correct
34 Partially correct 46 ms 384 KB Output is partially correct
35 Partially correct 49 ms 384 KB Output is partially correct
36 Partially correct 47 ms 384 KB Output is partially correct
37 Partially correct 49 ms 384 KB Output is partially correct
38 Partially correct 50 ms 384 KB Output is partially correct
39 Partially correct 51 ms 504 KB Output is partially correct
40 Partially correct 50 ms 376 KB Output is partially correct