# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
372556 | 2021-02-28T19:43:32 Z | Christopher_Rdz | Garage (IOI09_garage) | C++17 | 2 ms | 364 KB |
#include <iostream> #include <queue> using namespace std; int espacio[102]; int carros[2002]; int cubeta[102]; queue<int> cola; int main(){ ios_base::sync_with_stdio(0); int n, m, aux; int tot = 0; cin >> n >> m; for (int i = 1; i <= n; i++){ cin >> espacio[i]; } for (int i = 1; i <= m; i++){ cin >> carros[i]; } int lugar = 1; for (int i = 1; i <= m * 2; i++){ cin >> aux; if (aux > 0){ lugar = 0; for (int i = 1; i <= n; i++){ if (cubeta[i] == 0){ cubeta[i] = aux; lugar = i; break; } } if (lugar != 0){ tot += espacio[lugar] * carros[aux]; }else{ cola.push(aux); } }else{ int pos; for (int i = 1; i <= n; i++){ if (cubeta[i] == abs(aux)){ cubeta[i] = 0; pos = i; break; } } if (cola.size() >= 1){ int f = cola.front(); cola.pop(); tot += espacio[pos] * carros[f]; } } } cout << tot; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Incorrect | 0 ms | 364 KB | Output isn't correct |
7 | Correct | 0 ms | 364 KB | Output is correct |
8 | Incorrect | 1 ms | 364 KB | Output isn't correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Incorrect | 1 ms | 364 KB | Output isn't correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Incorrect | 1 ms | 364 KB | Output isn't correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Incorrect | 1 ms | 364 KB | Output isn't correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Incorrect | 1 ms | 364 KB | Output isn't correct |
17 | Incorrect | 1 ms | 364 KB | Output isn't correct |
18 | Incorrect | 2 ms | 364 KB | Output isn't correct |
19 | Incorrect | 1 ms | 364 KB | Output isn't correct |
20 | Incorrect | 1 ms | 364 KB | Output isn't correct |