| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 630584 | lucri | Garage (IOI09_garage) | C++17 | 3 ms | 340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n,m,r[110],g[2010],p[2010],x,ans;
priority_queue<int>a;
queue<int>b;
int main()
{
cin>>n>>m;
for(int i=1;i<=n;++i)
{
a.push(-i);
cin>>r[i];
}
for(int i=1;i<=m;++i)
{
cin>>g[i];
}
m*=2;
for(int i=1;i<=m;++i)
{
cin>>x;
if(x<0)
a.push(-p[-x]);
else
{
b.push(x);
}
if(!b.empty()&&!a.empty())
{
int z=-a.top();
a.pop();
int poz=b.front();
b.pop();
p[poz]=z;
ans+=g[poz]*r[z];
}
}
cout<<ans;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
