| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 287380 | Namnamseo | Garage (IOI09_garage) | C++17 | 2 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <cstdlib>
int sc[2010];
int ww[2010];
int place[2010];
int who [2010];
int n,m;
int queue[2010];
int h,t;
int main()
{
int income=0;
scanf("%d%d",&n,&m);
for(int i=1; i<=n; ++i) scanf("%d",sc+i);
for(int i=1; i<=m; ++i) scanf("%d",ww+i);
int a;
int filled=0;
for(int _=1; _<=2*m; ++_){
scanf("%d",&a);
if(a>0){
queue[h++]=a;
} else {
a=-a;
who[place[a]]=0;
place[a]=0;
--filled;
}
while(filled<n && t<h){
int i;
for(i=1; i<=n; ++i){
if(who[i]==0) break;
}
who[i]=queue[t];
place[queue[t]]=i;
income += sc[i]*ww[who[i]];
++filled; ++t;
}
}
printf("%d\n",income);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
