Submission #1361857

#TimeUsernameProblemLanguageResultExecution timeMemory
1361857jumpKoala Game (APIO17_koala)C++20
29 / 100
16 ms432 KiB
#include "koala.h"
#include <bits/stdc++.h>
int parr[110];
int res[110];
int NG,NW,PH;
int call=1;
int theres=13;
void play(){
    // while(call>theres);
    // std::cout << "in";
    // for(int i=0;i<NG;i++)std::cout << parr[i];
    // std::cout << '\n';
    // std::cout << call;
    playRound(parr,res);
    // std::cout << "out";
    // for(int i=0;i<NW;i++)std::cout << res[i];
    // std::cout << '\n';
    // ++call;
    // std::cin >> PH;
}
int minValue(int N, int W) {
    NG=N,NW=W;
    // TODO: Implement Subtask 1 solution here.
    // You may leave this function unmodified if you are not attempting this
    // subtask.
    parr[0]=1;
    play();
    if(res[0]<2)return 0;
    for(int i=1;i<N;i++){
        if(res[i]==0)return i;
    }
    return 0;
}
/*
1 1   
10 10
2 1 3 4 5 6 7 8 9 10
*/
/*
1 1   
10 10
10 3 2 4 5 6 7 8 9 1
*/
int maxValue(int N, int W) {
    NG=N,NW=W;
    for(int i=0;i<N;i++){
        parr[i]=0;
        res[i]=0;
    }
    bool notans[105];
    for(int i=0;i<N;i++){
        notans[i]=false;
    }
    // TODO: Implement Subtask 2 solution here.
    // You may leave this function unmodified if you are not attempting this
    // subtask.
    int cnt=N;
    int t=0;
    std::vector<int> precalcN={1,2,4,11,14,14,14,14,14,14,14};
    while(cnt>1){
        //std::cout << cnt << ' ';
        for(int i=0;i<N;i++){
            if(notans[i])parr[i]=0;
            else parr[i]=precalcN[t];
        }
        play();
        for(int i=0;i<N;i++){
            if(notans[i])continue;
            if(parr[i]>=res[i])cnt-=1,notans[i]=true;
        }
        t++;
        //std::cout << cnt << '|';
    }
    for(int i=0;i<N;i++)if(!notans[i])return i;
    return 0;
}
/*
2 1   
10 10
10 3 2 4 5 6 7 8 9 1
*/
/*
2 1   
100 100
21 10 39 58 46 91 67 40 99 53 71 89 48 78 16 38 81 28 2 34 45 8 88 54 55 42 11 93 74 84 32 20 56 44 17 29 92 96 26 30 69 57 97 5 85 27 95 35 98 24 25 63 15 41 49 13 47 83 31 72 6 37 22 75 61 59 43 94 52 65 73 51 7 70 19 87 64 36 3 77 86 62 33 79 18 76 60 100 82 9 1 23 4 14 80 66 68 12 50 90
*/
/*
2 1   
100 100
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
*/

int greaterValue(int N, int W) {
    NG=N,NW=W;
    for(int i=0;i<N;i++){
        parr[i]=0;
        res[i]=0;
    }
    // TODO: Implement Subtask 3 solution here.
    // You may leave this function unmodified if you are not attempting this
    // subtask.
    return 0;
}

void allValues(int N, int W, int *P) {
    NG=N,NW=W;
    for(int i=0;i<N;i++)P[i]=-1;
    for(int l=0;l<N-1;l++){
        //std::cout << '-' << l << ':' << '\n';
        for(int i=0;i<N;i++){
            parr[i]=0;
            res[i]=0;
        }
        bool notRes[105];
        int cnt=N;
        for(int i=0;i<N;i++){
            notRes[i]=false;
            if(P[i]!=-1)cnt-=1,notRes[i]=true;
        }
        int t=0;
        while(cnt>1){
            for(int i=0;i<N;i++){
                if(notRes[i])parr[i]=0;
                //if(P[i]!=-1&&l!=0)parr[i]=100/(l);
                else parr[i]=(W/(cnt));
            }
            //std::cout << '|' << cnt << "->";
            play();
            for(int i=0;i<N;i++){
                if(notRes[i])continue;
                if(parr[i]>=res[i])cnt-=1,notRes[i]=true;
            }
            t++;
        }
        bool found=false;
        for(int i=0;i<N;i++){
            if(!notRes[i]){
                P[i]=N-l;
                found=true;
                //std::cout << i << "->" << N-l << '\n';
                break;
            }
        }
        if(!found){
            std::cout << l << ' ';
            std::cin >> PH;
        }
        //std::cin >> PH;
    }
    for(int i=0;i<N;i++)if(P[i]==-1)P[i]=1;
    return;
    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.
    }
}
/*
4 1   
100 200
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
*/
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...