# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1088552 | vjudge1 | Bank (IZhO14_bank) | C11 | 1 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |