Submission #767389

#TimeUsernameProblemLanguageResultExecution timeMemory
767389sraeliArchery (IOI09_archery)C11
0 / 100
324 ms1844 KiB
#include <stdio.h>

int main() {
    int N, R;
    if (scanf("%d %d", &N, &R) != 2) {
        return 1;
    }

    int myRank;
    if (scanf("%d", &myRank) != 1) {
        return 1;
    }

    int competitorRanks[400000];
    for (int i = 0; i < 2 * N - 1; i++) {
        if (scanf("%d", &competitorRanks[i]) != 1) {
            return 1;
        }
    }

    int target = 1; // Alvo inicial (alvo 1)
    int round = 1;

    while (round < R) {
        if (target == 1) {
            if (myRank < competitorRanks[0]) {
                target = N; // O perdedor do alvo 1 se move para o alvo N
            }
        } else {
            if (myRank < competitorRanks[(target - 2) * 2]) {
                target--; // Os vencedores se movem para a esquerda
            }
        }

        round++;
    }

    printf("%d\n", target);

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...