| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 495434 | ToroTN | Garage (IOI09_garage) | C++14 | 2 ms | 336 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int n,m,hsh[105],w[2005],r[105],car,cnt=0,u,type;
queue<int> q;
int main()
{
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
{
scanf("%d",&r[i]);
}
for(int i=1;i<=m;i++)
{
scanf("%d",&w[i]);
}
for(int i=1;i<=2*m;i++)
{
scanf("%d",&car);
if(car>0)
{
q.push(car);
}else
{
for(int j=1;j<=n;j++)
{
if(hsh[j]==-car)
{
hsh[j]=0;
}
}
}
while(!q.empty())
{
u=q.front();
type=-1;
for(int j=1;j<=n;j++)
{
if(hsh[j]==0)
{
type=0;
hsh[j]=u;
cnt+=r[j]*w[u];
break;
}
}
if(type==-1)
{
break;
}
q.pop();
}
//printf("%d\n",cnt);
}
printf("%d\n",cnt);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
