# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
228428 | 2020-05-01T02:34:50 Z | s_avila_g | Garage (IOI09_garage) | C++14 | 320 ms | 444 KB |
#include <bits/stdc++.h> using namespace std; queue<int> col; map<int,int> mp; int main(){ freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); int n,m; cin>>n>>m; vector<int> parks(n); vector<int> cars(n); for(int i = 0 ; i < n; i++)cin>>parks[i]; for(int i = 0 ; i < m; i++)cin>>cars[i]; int vis[n]; memset(vis,0,sizeof vis); int ans = 0; for(int i = 0 ; i < (2*m); i++){ int x; cin>>x; bool libre = false; if(x > 0){ int pos; for(int j = 0; j < n; j++){ if(vis[j] == 0){ libre = true; pos = j; break; } } if(!libre){ col.push(x); }else{ mp[x] = pos; ans += cars[x-1] * parks[pos]; vis[pos] = 1; } }else{ vis[mp[abs(x)]] = 0; if(!col.empty()){ int nxt = col.front(); vis[mp[abs(x)]] = 1; col.pop(); ans += cars[nxt-1] * parks[mp[abs(x)]]; } mp[abs(x)] = -1; } } cout<<ans<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 309 ms | 384 KB | Output isn't correct |
2 | Incorrect | 316 ms | 376 KB | Output isn't correct |
3 | Incorrect | 318 ms | 444 KB | Output isn't correct |
4 | Incorrect | 312 ms | 384 KB | Output isn't correct |
5 | Incorrect | 314 ms | 360 KB | Output isn't correct |
6 | Incorrect | 313 ms | 352 KB | Output isn't correct |
7 | Incorrect | 314 ms | 376 KB | Output isn't correct |
8 | Incorrect | 312 ms | 352 KB | Output isn't correct |
9 | Incorrect | 316 ms | 376 KB | Output isn't correct |
10 | Incorrect | 312 ms | 256 KB | Output isn't correct |
11 | Incorrect | 317 ms | 256 KB | Output isn't correct |
12 | Incorrect | 313 ms | 256 KB | Output isn't correct |
13 | Incorrect | 316 ms | 256 KB | Output isn't correct |
14 | Incorrect | 315 ms | 376 KB | Output isn't correct |
15 | Incorrect | 312 ms | 256 KB | Output isn't correct |
16 | Incorrect | 316 ms | 376 KB | Output isn't correct |
17 | Incorrect | 313 ms | 256 KB | Output isn't correct |
18 | Incorrect | 316 ms | 256 KB | Output isn't correct |
19 | Incorrect | 320 ms | 420 KB | Output isn't correct |
20 | Incorrect | 311 ms | 256 KB | Output isn't correct |