Submission #767387

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

int main() {
    int N, R;
    scanf("%d %d", &N, &R);

    int myRank, competitorRanks[400000];
    scanf("%d", &myRank);

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

    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;
}

Compilation message (stderr)

archery.c: In function 'main':
archery.c:5:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    5 |     scanf("%d %d", &N, &R);
      |     ^~~~~~~~~~~~~~~~~~~~~~
archery.c:8:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d", &myRank);
      |     ^~~~~~~~~~~~~~~~~~~~
archery.c:11:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d", &competitorRanks[i]);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...