# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
275825 | 2020-08-20T07:54:34 Z | barsbold | Garage (IOI09_garage) | C++14 | 2 ms | 512 KB |
#include<bits/stdc++.h> #define pb push_back #define mp make_pair #define ff first #define ss second using namespace std; int r[101]; int w[101]; int s[202]; int vis[101]; int res =0; int n , m; int main(){ cin >> n; cin >>m; memset(vis , 0 , sizeof(vis)); vector<int> wait; for(int i = 1; i<=n; i++){ cin >> r[i]; } for(int i = 1; i<=m; i++){ cin >> w[i]; } for(int i = 1; i<=m * 2; i++){ int tmp; cin >> tmp; if(tmp > 0){ bool flag =true; for(int i = 1; i<=n; i++){ if(vis[i] == 0){ res+=r[i] * w[tmp]; vis[i] = tmp; flag = false; break; } } if(flag) wait.pb(tmp); } else { int sul ; for(int i = 1; i<=n; i++){ if(vis[i] == tmp * (-1)){ vis[i] = 0; sul = i; } } if(wait.size()!=0) { res+=w[wait[0]] * r[sul]; wait.erase(wait.begin()); } } } cout << res << endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Incorrect | 1 ms | 256 KB | Output isn't correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Incorrect | 1 ms | 256 KB | Output isn't correct |
9 | Correct | 1 ms | 256 KB | Output is correct |
10 | Incorrect | 1 ms | 256 KB | Output isn't correct |
11 | Incorrect | 1 ms | 256 KB | Output isn't correct |
12 | Runtime error | 2 ms | 384 KB | Execution killed with signal 11 |
13 | Runtime error | 2 ms | 512 KB | Execution killed with signal 11 |
14 | Runtime error | 2 ms | 384 KB | Execution killed with signal 11 |
15 | Runtime error | 1 ms | 384 KB | Execution killed with signal 11 |
16 | Runtime error | 1 ms | 384 KB | Execution killed with signal 11 |
17 | Runtime error | 2 ms | 384 KB | Execution killed with signal 11 |
18 | Runtime error | 2 ms | 384 KB | Execution killed with signal 11 |
19 | Runtime error | 2 ms | 384 KB | Execution killed with signal 11 |
20 | Runtime error | 2 ms | 384 KB | Execution killed with signal 11 |