제출 #585522

#제출 시각아이디문제언어결과실행 시간메모리
585522krit3379Garage (IOI09_garage)C++17
100 / 100
1 ms340 KiB
#include<bits/stdc++.h> using namespace std; #define N 2005 #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") int l[N],r[N],w[N],sz,ans; bitset<N> park; queue<int> q; int main(){ int n,m,i,j,x; scanf("%d %d",&n,&m); for(i=1;i<=n;i++)scanf("%d",&r[i]); for(i=1;i<=m;i++)scanf("%d",&w[i]); sz=n; for(i=1;i<=(m<<1);i++){ scanf("%d",&x); if(x>0)q.push(x); else sz++,park[l[-x]]=false; while(!q.empty()&&sz){ for(j=1;j<=n;j++)if(!park[j]){park[j]=true,sz--,l[q.front()]=j,ans+=r[j]*w[q.front()];break;} q.pop(); } } printf("%d",ans); return 0; }

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

garage.cpp: In function 'int main()':
garage.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d %d",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~
garage.cpp:14:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     for(i=1;i<=n;i++)scanf("%d",&r[i]);
      |                      ~~~~~^~~~~~~~~~~~
garage.cpp:15:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     for(i=1;i<=m;i++)scanf("%d",&w[i]);
      |                      ~~~~~^~~~~~~~~~~~
garage.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         scanf("%d",&x);
      |         ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...