Submission #767401

# Submission time Handle Problem Language Result Execution time Memory
767401 2023-06-26T17:49:57 Z sraeli Archery (IOI09_archery) C
Compilation error
0 ms 0 KB
#include <stdio.h>

int encontrar_posicao_inicial(int N, int minhaClassificacao, int* competitorRanks) {
    int melhorPosicao = 1;

    for (int i = 0; i < 2 * N - 1; i += 2) {
        if (competitorRanks[i] < minhaClassificacao) {
            melhorPosicao++;
        }
    }

    return melhorPosicao;
}

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

    int minhaClassificacao;
    scanf("%d", &minhaClassificacao) __attribute__((unused));

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

    int posicaoInicial = encontrar_posicao_inicial(N, minhaClassificacao, competitorRanks);
    printf("%d\n", posicaoInicial);

    return 0;
}

Compilation message

archery.c: In function 'main':
archery.c:17:27: error: expected ';' before '__attribute__'
   17 |     scanf("%d %d", &N, &R) __attribute__((unused));
      |                           ^~~~~~~~~~~~~~
      |                           ;
archery.c:20:37: error: expected ';' before '__attribute__'
   20 |     scanf("%d", &minhaClassificacao) __attribute__((unused));
      |                                     ^~~~~~~~~~~~~~
      |                                     ;
archery.c:24:41: error: expected ';' before '__attribute__'
   24 |         scanf("%d", &competitorRanks[i]) __attribute__((unused));
      |                                         ^~~~~~~~~~~~~~
      |                                         ;
archery.c:17:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     scanf("%d %d", &N, &R) __attribute__((unused));
      |     ^~~~~~~~~~~~~~~~~~~~~~
archery.c:20:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     scanf("%d", &minhaClassificacao) __attribute__((unused));
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
archery.c:24:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         scanf("%d", &competitorRanks[i]) __attribute__((unused));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~