제출 #172557

#제출 시각아이디문제언어결과실행 시간메모리
172557mcl2000Garage (IOI09_garage)C++98
100 / 100
3 ms504 KiB
#include<bits/stdc++.h> using namespace std; bool lleno[105], pila=true; int dinero[105], carro[2010], hola[105], t; queue<int>numeros; int a, b, g; long long int cont=0; int main() { scanf("%d %d", &a, &b); for(int i=1; i<a+1; i++) { scanf("%d", &dinero[i]); lleno[i]=false; } for(int i=1; i<b+1; i++) { scanf("%d", &carro[i]); } for(int i=0; i<2*b; i++) { scanf("%d", &g); if(g>0) { for(int j=1; j<a+1; j++) { pila=true; if(lleno[j]==false) { cont+=(dinero[j]*carro[g]); hola[j]=g; lleno[j]=true; pila=false; break; } } if(pila!=false) { numeros.push(g); } } else { if(g<0) { for(int j=1; j<a+1; j++) { if(hola[j]==g*(-1)) { lleno[j]=false; if(!numeros.empty()) { t=numeros.front(); numeros.pop(); cont+=(dinero[j]*carro[t]); hola[j]=t; lleno[j]=true; } break; } } } } } printf("%lld", cont); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

garage.cpp: In function 'int main()':
garage.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &a, &b);
     ~~~~~^~~~~~~~~~~~~~~~~
garage.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &dinero[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~
garage.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &carro[i]);
         ~~~~~^~~~~~~~~~~~~~~~~
garage.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &g);
         ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...