Submission #767361

# Submission time Handle Problem Language Result Execution time Memory
767361 2023-06-26T16:59:45 Z sraeli Archery (IOI09_archery) C
Compilation error
0 ms 0 KB
 #include <stdio.h> 
 
int encontrar_posicao_inicial ( int N , int * arqueiros ) {  
    int minha_classificação = arqueiros [ 0 ]; // Sua classificação é o primeiro elemento do array 
 
    // Verifique se você é o melhor ou o pior arqueiro
    if ( minha_classificacao == 1 || minha_classificacao == 2 * N ) {      
        retornar 1 ; // Se você for o melhor ou o pior, comece no alvo 1  
    } senão {  
        retornar 2 ; // Caso contrário, comece no alvo 2  
    }
}
 
int principal () { 
    int N , R ;
    scanf ( "%d %d" , & N , & R );  
 
    int arqueiros [ 2 * N ]; 
    for ( int i = 0 ; i < 2 * N ; i ++) {     
        scanf ( "%d" , & arqueiros [ i ]); 
    }
 
    int posicao_inicial = encontrar_posicao_inicial ( N , arqueiros );
    printf ( "%d\n" , posicao_inicial );
 
    retorna 0 ; 
}

Compilation message

archery.c: In function 'encontrar_posicao_inicial':
archery.c:7:10: error: 'minha_classificacao' undeclared (first use in this function); did you mean 'minha_classificação'?
    7 |     if ( minha_classificacao == 1 || minha_classificacao == 2 * N ) {
      |          ^~~~~~~~~~~~~~~~~~~
      |          minha_classificação
archery.c:7:10: note: each undeclared identifier is reported only once for each function it appears in
archery.c:8:9: error: 'retornar' undeclared (first use in this function)
    8 |         retornar 1 ; // Se você for o melhor ou o pior, comece no alvo 1
      |         ^~~~~~~~
archery.c:8:17: error: expected ';' before numeric constant
    8 |         retornar 1 ; // Se você for o melhor ou o pior, comece no alvo 1
      |                 ^~
      |                 ;
archery.c:9:7: error: 'sen\U000000e3o' undeclared (first use in this function)
    9 |     } senão {
      |       ^~~~~
archery.c:9:13: error: expected ';' before '{' token
    9 |     } senão {
      |            ^~
      |            ;
archery.c:4:9: warning: unused variable 'minha_classifica\U000000e7\U000000e3o' [-Wunused-variable]
    4 |     int minha_classificação = arqueiros [ 0 ]; // Sua classificação é o primeiro elemento do array
      |         ^~~~~~~~~~~~~~~~~~~
archery.c: In function 'principal':
archery.c:26:5: error: 'retorna' undeclared (first use in this function)
   26 |     retorna 0 ;
      |     ^~~~~~~
archery.c:26:12: error: expected ';' before numeric constant
   26 |     retorna 0 ;
      |            ^~
      |            ;
archery.c: In function 'encontrar_posicao_inicial':
archery.c:12:1: warning: control reaches end of non-void function [-Wreturn-type]
   12 | }
      | ^
archery.c: In function 'principal':
archery.c:16:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf ( "%d %d" , & N , & R );
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
archery.c:20:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf ( "%d" , & arqueiros [ i ]);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
archery.c:27:1: warning: control reaches end of non-void function [-Wreturn-type]
   27 | }
      | ^