# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
536169 | timreizin | Garage (IOI09_garage) | C++17 | 2 ms | 436 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
vector<int> r(n), w(m);
for (int &i : r) cin >> i;
for (int &i : w) cin >> i;
vector<int> slots(n);
int res = 0;
for (int i = 0; i < 2 * m; ++i)
{
int c;
cin >> c;
if (c > 0)
{
for (int j = 0; j < n; ++j)
{
if (slots[j] == 0)
{
res += w[c - 1] * r[j];
slots[j] = c;
break;
}
}
}
else
{
for (int j = 0; j < n; ++j)
{
if (slots[j] == -c)
{
slots[j] = 0;
break;
}
}
}
}
cout << res;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |