Submission #1088552

#TimeUsernameProblemLanguageResultExecution timeMemory
1088552vjudge1Bank (IZhO14_bank)C11
0 / 100
1 ms348 KiB
#include <stdio.h> void ordena(int v[], int tam){ for(int i=0;i<tam-1;i++){ int min = i; for(int j = i+1; j < tam; j++){ if(v[j] > v[min]){ min = j; } } if(i != min){ int aux = v[i]; v[i] = v[min]; v[min] = aux; } } } int main(){ int N, M, vazio = 1; scanf("%d", &N); scanf("%d", &M); int salarios[N]; int celulas[M]; for(int i=0; i < N; i++){ scanf("%d", &salarios[i]); } for(int i=0; i < M; i++){ scanf("%d", &celulas[i]); } ordena(salarios, N); ordena(celulas, M); for(int i = 0; i < N; i++){ for(int j = 0; j < M && salarios[i] != 0; j++){ if(celulas[j] <= salarios[i]){ salarios[i] -= celulas[j]; } } if(salarios[i] != 0){ vazio = 0; break; } } if(!vazio){ printf("NO"); }else{ printf("YES"); } }

Compilation message (stderr)

bank.c: In function 'main':
bank.c:21:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |   scanf("%d", &N);
      |   ^~~~~~~~~~~~~~~
bank.c:22:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |   scanf("%d", &M);
      |   ^~~~~~~~~~~~~~~
bank.c:28:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |     scanf("%d", &salarios[i]);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~
bank.c:32:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |     scanf("%d", &celulas[i]);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...