| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 879051 | klee | Garage (IOI09_garage) | C++14 | 2 ms | 604 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
vector<int> have(101), where(101);
int main()
{
int n,m;
cin >> n >> m;
vector<int> price(n+1), weight(m+1);
for(int i=1;i<=n;i++) cin >> price[i];
for(int i=1;i<=m;i++) cin >> weight[i];
int ans=0;
for(int i=0;i<2*m;i++)
{
int x;
cin >> x;
if(x>=0)
{
for(int j=1;j<=n;j++)
{
if(have[j] == 0)
{
have[j] = 1;
ans+= (price[j]*weight[x]);
// cout << j << 'a' << x << ' ' << price[j] << ' ' << weight[x] << ' ' << price[j]*weight[x] << ' ' << ans << ' ' << '\n';
where[x] = j;
break;
}
}
}
else
{
x = abs(x);
int a = where[x];
have[a] = 0;
}
}
cout << ans << '\n';
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
