답안 #1090080

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1090080 2024-09-17T17:10:32 Z alexander707070 코알라 (APIO17_koala) C++14
59 / 100
50 ms 600 KB
#include<bits/stdc++.h>
#define MAXN 107
#include "koala.h"

using namespace std;

int b[MAXN],r[MAXN];

int minValue(int N, int W) {
    b[0]=1;
    playRound(b,r);

    for(int i=0;i<N;i++){
        if(r[i]==0)return i;
    }
    return 0;
}

vector<int> can,best;

void reset(){
    best.clear(); can.clear();
    for(int i=0;i<100;i++)b[i]=0;
}

int maxValue(int N, int W) {
    reset();

    for(int i=0;i<100;i++)can.push_back(i);
    
    while(can.size()>1){
        for(int i=0;i<100;i++)b[i]=0;

        for(int i:can){
            b[i]=W/int(can.size());
        }

        playRound(b,r);

        for(int i:can){
            if(r[i]>b[i])best.push_back(i);
        }

        can=best; best={};
    }

    return can[0];
}

int from[MAXN],to[MAXN];

bool compare(int x,int y){
    for(int i=0;i<100;i++)b[i]=0;
    
    int ll=0,rr=10,tt;

    while(ll+1<rr){
        tt=(ll+rr)/2;

        b[x]=b[y]=tt;
        playRound(b,r);

        if(r[x]<=tt and r[y]<=tt){
            rr=tt;
        }else if(r[x]>tt and r[y]>tt){
            ll=tt;
        }else{
            if(r[x]>=tt)return false;
            else return true;
        }
    }

    return false;
}

int greaterValue(int N, int W) {

    if(compare(0,1))return 1;
    else return 0;
}

int order[MAXN];

void allValues(int N, int W, int *P) {
    for(int i=0;i<100;i++){
        order[i]=i;

        from[i]=1; to[i]=100;
    }

    sort(order,order+100,compare);

    for(int i=0;i<N;i++){
        P[order[i]]=i+1;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 3 ms 456 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 344 KB Output is correct
2 Correct 10 ms 344 KB Output is correct
3 Correct 10 ms 344 KB Output is correct
4 Correct 9 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 47 ms 452 KB Output is correct
2 Correct 50 ms 600 KB Output is correct
3 Correct 37 ms 488 KB Output is correct
4 Correct 37 ms 344 KB Output is correct
5 Correct 40 ms 344 KB Output is correct
6 Correct 39 ms 460 KB Output is correct
7 Correct 41 ms 344 KB Output is correct
8 Correct 38 ms 344 KB Output is correct
9 Correct 43 ms 344 KB Output is correct
10 Correct 37 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 36 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 29 ms 344 KB Output is partially correct
2 Partially correct 29 ms 344 KB Output is partially correct
3 Partially correct 27 ms 344 KB Output is partially correct
4 Partially correct 30 ms 344 KB Output is partially correct
5 Partially correct 31 ms 344 KB Output is partially correct
6 Partially correct 27 ms 344 KB Output is partially correct
7 Partially correct 29 ms 456 KB Output is partially correct
8 Partially correct 29 ms 344 KB Output is partially correct
9 Partially correct 29 ms 344 KB Output is partially correct
10 Partially correct 25 ms 444 KB Output is partially correct
11 Partially correct 27 ms 432 KB Output is partially correct
12 Partially correct 20 ms 448 KB Output is partially correct
13 Partially correct 28 ms 388 KB Output is partially correct
14 Partially correct 27 ms 344 KB Output is partially correct
15 Partially correct 25 ms 452 KB Output is partially correct
16 Partially correct 31 ms 344 KB Output is partially correct
17 Partially correct 31 ms 344 KB Output is partially correct
18 Partially correct 30 ms 448 KB Output is partially correct
19 Partially correct 26 ms 344 KB Output is partially correct
20 Partially correct 28 ms 344 KB Output is partially correct
21 Partially correct 26 ms 344 KB Output is partially correct
22 Partially correct 29 ms 344 KB Output is partially correct
23 Partially correct 22 ms 344 KB Output is partially correct
24 Partially correct 28 ms 344 KB Output is partially correct
25 Partially correct 28 ms 340 KB Output is partially correct
26 Partially correct 29 ms 344 KB Output is partially correct
27 Partially correct 28 ms 344 KB Output is partially correct
28 Partially correct 28 ms 452 KB Output is partially correct
29 Partially correct 27 ms 344 KB Output is partially correct
30 Partially correct 28 ms 340 KB Output is partially correct
31 Partially correct 27 ms 344 KB Output is partially correct
32 Partially correct 28 ms 344 KB Output is partially correct
33 Partially correct 28 ms 344 KB Output is partially correct
34 Partially correct 25 ms 344 KB Output is partially correct
35 Partially correct 27 ms 456 KB Output is partially correct
36 Partially correct 27 ms 344 KB Output is partially correct
37 Partially correct 28 ms 344 KB Output is partially correct
38 Partially correct 34 ms 344 KB Output is partially correct
39 Partially correct 28 ms 344 KB Output is partially correct
40 Partially correct 28 ms 344 KB Output is partially correct