제출 #536169

#제출 시각아이디문제언어결과실행 시간메모리
536169timreizinGarage (IOI09_garage)C++17
40 / 100
2 ms436 KiB
#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 timeMemoryGrader output
Fetching results...