제출 #151331

#제출 시각아이디문제언어결과실행 시간메모리
151331GioChkhaidzeGarage (IOI09_garage)C++14
100 / 100
5 ms416 KiB
#include <bits/stdc++.h> #define F first #define S second using namespace std; const int N=104; const int M=2004; long long n,m,Cars; long long R[N],W[M],Id[M]; long long ANS; bool F[N]; queue < int > q; main () { cin>>n>>m; for (int i=1; i<=n; i++) cin>>R[i]; for (int i=1; i<=m; i++) cin>>W[i]; for (int i=1; i<=2*m; i++) { int idx=0; cin>>idx; if (idx<0) idx=-idx,Cars--,F[Id[idx]]=0; else q.push(idx); while (q.size() && n>Cars) { int ID=q.front(); q.pop(); for (int j=1; j<=n; j++) if (!F[j]) { Cars++,F[j]=1,Id[ID]=j; ANS+=R[j]*W[ID]; break; } } } cout<<ANS<<endl; }

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

garage.cpp:18:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
#Verdict Execution timeMemoryGrader output
Fetching results...