# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1094823 | 2024-09-30T15:59:42 Z | salmon | Garage (IOI09_garage) | C++14 | 1 ms | 604 KB |
#include <bits/stdc++.h> using namespace std; int N; int M; int R[110]; set<int> sat; int inv[110]; int tim[110]; int W[2100]; int x; queue<int> q; int main(){ scanf(" %d",&N); scanf(" %d",&M); for(int i = 0; i < N; i++){ scanf(" %d",&R[i]); sat.insert(i); } for(int i = 1; i <= M; i++){ inv[i] = -1; scanf(" %d",&W[i]); } long long int ans = 0; for(int i = 0; i < M * 2; i ++){ scanf(" %d",&x); if(x < 0){ x = -x; sat.insert(inv[x]); ans += R[inv[x]] * W[x]; if(!q.empty()){ x = q.front(); q.pop(); } else x = -1; } if(x > 0){ if(sat.empty()){ q.push(x); continue; } int l = *sat.begin(); sat.erase(sat.begin()); tim[l] = i; inv[x] = l; } } printf("%lld",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 444 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Runtime error | 0 ms | 348 KB | Execution killed with signal 11 |
11 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
12 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
13 | Runtime error | 0 ms | 348 KB | Execution killed with signal 11 |
14 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
15 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
16 | Runtime error | 0 ms | 348 KB | Execution killed with signal 11 |
17 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
18 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
19 | Runtime error | 0 ms | 348 KB | Execution killed with signal 11 |
20 | Runtime error | 0 ms | 348 KB | Execution killed with signal 11 |