Submission #767342

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

int main() {
    int N, R;
    scanf("%d %d", &N, &R);
    
    int archers[400000]; // Vetor para armazenar as classificações dos arqueiros
    
    // Leitura das classificações dos arqueiros
    for (int i = 0; i < 2 * N - 1; i++) {
        scanf("%d", &archers[i]);
    }
    
    int start_target = N; // Alvo onde o jogador deve começar
    
    // Verificação do alvo de início
    for (int i = 0; i < 2 * N - 1; i++) {
        if (archers[i] < archers[2 * N - 2]) {
            // Se a classificação do jogador for menor que a do último arqueiro na fila, ele deve começar em um alvo posterior
            start_target = (i % N) + 1;
            break;
        }
    }
    
    printf("%d\n", start_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:11:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d", &archers[i]);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...