# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134411 | 2019-07-22T16:19:55 Z | sheismad | Garage (IOI09_garage) | C++14 | 3 ms | 508 KB |
#include <cstdio> #include <iostream> #include <queue> using namespace std; int const MAXN = 101,MAXM = 2001; int park[MAXN]; int main() { //freopen("input.txt","r",stdin); int n,m,weight[MAXM],price[MAXN],car; long long ans = 0; queue<int> q; scanf("%d %d\n",&n,&m); for (int i=0;i<n;i++) scanf("%d",&price[i]); for (int i=0;i<m;i++) scanf("%d",&weight[i]); int j,mini = 0; for (int i=0;i<m*2;i++) { scanf("%d",&car); j = 0; //arrive if (car>0) { while (park[j] && j<n) j++; //there is an empty space if (j<n) { if (q.empty()) { park[j] = car; ans += price[j]*weight[car-1]; } else { q.push(car); park[j] = q.front(); ans += price[j]*weight[q.front()-1]; q.pop(); } } // there is not else q.push(car); } //departure else { car *= -1; while (park[j]!=car) j++; if (!q.empty()) { park[j] = q.front(); ans += price[j]*weight[q.front()-1]; q.pop(); } } } cout << ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Incorrect | 2 ms | 376 KB | Output isn't correct |
5 | Incorrect | 2 ms | 256 KB | Output isn't correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Incorrect | 2 ms | 256 KB | Output isn't correct |
8 | Incorrect | 2 ms | 376 KB | Output isn't correct |
9 | Incorrect | 2 ms | 376 KB | Output isn't correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Runtime error | 2 ms | 376 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
12 | Runtime error | 2 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Runtime error | 3 ms | 376 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Runtime error | 3 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
15 | Runtime error | 3 ms | 376 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
16 | Runtime error | 3 ms | 376 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
17 | Runtime error | 3 ms | 376 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
18 | Runtime error | 3 ms | 508 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
19 | Correct | 3 ms | 376 KB | Output is correct |
20 | Runtime error | 3 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |