# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1110988 | Zflop | Garage (IOI09_garage) | C++14 | 1 ms | 592 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int NMAX = 101;
int N,M,ans,A[NMAX],aloc[2001],W[2001];
main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
set<int>m;
cin >> N >> M;
for (int i = 1; i <= N;++i) m.insert(i);
for (int i = 1; i <= N;++i)
cin >> A[i];
for (int i = 1; i <= M;++i)
cin >> W[i];
queue<int>q;
for (int i = 1; i <= 2 * M;++i) {
int x; cin >> x;
if (x > 0) {
q.push(x);
} else {
m.insert(aloc[-x]);
}
while (m.size() && q.size()) {
auto a = *m.begin();
auto b = q.front();
q.pop();
m.erase(a);
aloc[b] = a;
ans += A[a] * W[b];
}
}
cout << ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |