답안 #1028540

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1028540 2024-07-20T04:03:48 Z vjudge1 코알라 (APIO17_koala) C++17
24 / 100
140 ms 452 KB
#include "koala.h"
#include<bits/stdc++.h>
using namespace std;
int minValue(int N, int W) {
    int me[100]{1},you[100];
    playRound(me,you);
    for(int i=0;i<N;i++)
        if(you[i]==0)
            return i;
    return 0;
}

int maxValue(int N, int W) {
    int me[100],you[100];
    vector<int>theposs(N);
    iota(theposs.begin(),theposs.end(),0);
    while(theposs.size()>1){
        memset(me,0,sizeof me);
        for(auto i:theposs)
            me[i]=W/theposs.size();
        playRound(me,you);
        vector<int>theposs2;
        for(auto i:theposs)
            if(you[i])theposs2.push_back(i);
        theposs=theposs2;
    }
    return theposs[0];
}
int maxValue2(set<int>theposs, int W) {
    int me[100],you[100], ORIG=theposs.size();
    while(theposs.size()>1){
        memset(me,0,sizeof me);
        for(auto i:theposs)
            me[i]=(W+theposs.size()-ORIG)/theposs.size();
        playRound(me,you);
        set<int>theposs2;
        for(auto i:theposs)
            if(you[i])theposs2.insert(i);
        theposs=theposs2;
    }
    return *theposs.begin();
}

int greaterValue(int N, int W) {
    int me[100]{1,1},you[100];
    playRound(me,you);
    while(you[0]==you[1]){
        me[0]++;
        me[1]++;
        playRound(me,you);
    }
    return !you[0];
}

void allValues(int N, int W, int *P) {
    
    set<int>V;
    for(int i=0;i<N;i++)V.insert(i);
    for(int i=N;i;i--){
        int k=maxValue2(V,W);
        P[k]=i;
        V.erase(k);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 3 ms 340 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 11 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 Partially correct 113 ms 344 KB Output is partially correct
2 Partially correct 134 ms 452 KB Output is partially correct
3 Partially correct 111 ms 344 KB Output is partially correct
4 Partially correct 113 ms 344 KB Output is partially correct
5 Partially correct 113 ms 344 KB Output is partially correct
6 Partially correct 112 ms 344 KB Output is partially correct
7 Partially correct 110 ms 448 KB Output is partially correct
8 Partially correct 118 ms 344 KB Output is partially correct
9 Partially correct 140 ms 344 KB Output is partially correct
10 Partially correct 107 ms 344 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 35 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 79 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -