| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 252026 | ScarletS | Garage (IOI09_garage) | C++17 | 2 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n,m,x;
ll ans=0;
cin>>n>>m;
priority_queue<int,vector<int>,greater<int>> q;
deque<int> wait;
int r[n];
int w[m+1];
int a[m+1];
for (int i=0;i<n;++i)
{
cin>>r[i];
q.push(i);
}
for (int i=1;i<=m;++i)
cin>>w[i];
for (int i=0;i<2*m;++i)
{
cin>>x;
if (x<0)
q.push(a[-x]);
else
wait.push_back(x);
if (sz(q)&&sz(wait))
{
x=wait.front();
wait.pop_front();
ans+=r[q.top()]*w[x];
a[x]=q.top();
q.pop();
}
}
cout<<ans;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
