# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
172557 | mcl2000 | Garage (IOI09_garage) | C++98 | 3 ms | 504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |