# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
733916 | 2023-05-01T11:58:29 Z | vjudge1 | Garage (IOI09_garage) | C++17 | 2 ms | 468 KB |
#include<bits/stdc++.h> using namespace std; using ll = long long; int main() { int t, n, m, ans, i, z,j, x, r, p, s, y; cin >> n >> m; ll a[n + 2], b[m + 2], c[m + 2]; ans = 0; priority_queue < ll , vector < ll > , greater< ll >> pq; for ( i = 1; i <= n; i ++) { cin >> a[i]; pq.push(i); } for ( i = 1; i <= m; i ++) { cin >> b[i]; } queue < ll > q; for ( i = 1; i <= 2 * m; i ++) { cin >> x; if ( x < 0) { r = -x; pq.push(c[r]); } else { if ( pq.empty()) { q.push(x); } p = pq.top(); pq.pop(); c[x] = p; ans += (a[p] * b[x]); } if ( !pq.empty() && !q.empty()) { x = q.front(); q.pop(); p = pq.top(); pq.pop(); c[x] = p; ans += (a[p] * b[x]); } } cout << ans << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Runtime error | 1 ms | 340 KB | Execution killed with signal 6 |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Runtime error | 1 ms | 340 KB | Execution killed with signal 6 |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Runtime error | 1 ms | 340 KB | Execution killed with signal 6 |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Runtime error | 1 ms | 340 KB | Execution killed with signal 11 |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Runtime error | 1 ms | 340 KB | Execution killed with signal 11 |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Runtime error | 1 ms | 340 KB | Execution killed with signal 6 |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Runtime error | 1 ms | 468 KB | Execution killed with signal 6 |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Runtime error | 2 ms | 468 KB | Execution killed with signal 11 |
17 | Runtime error | 2 ms | 468 KB | Execution killed with signal 6 |
18 | Runtime error | 2 ms | 468 KB | Execution killed with signal 6 |
19 | Incorrect | 2 ms | 340 KB | Output isn't correct |
20 | Runtime error | 2 ms | 468 KB | Execution killed with signal 6 |