# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
733907 | 2023-05-01T11:50:46 Z | vjudge1 | Garage (IOI09_garage) | C++17 | 1 ms | 340 KB |
#include <bits/stdc++.h> using namespace std; //#define int long long #define ff first #define ss second #define pb push_back #define ub upper_bound #define lb lower_bound #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); const int max6 = 2e6 + 1; const int max5 = 2e5 + 1; const int max9 = 1e9 + 1; const int mod = 1e9 + 7; const long long infinity = 1e15 + 7; vector<int> order; vector<int> wait; int n, m, income; int cost[101], w[2001], gar[2001], av[2001]; void into(int a) { int j; for (j = 1; j <= n; j++) if (av[j] == 0) { gar[a] = j; av[j] = 1; income += cost[j] * w[a]; return; } wait.pb(a); } int32_t main() { fastio; cin >> n >> m; for (int i = 1; i <= n; i++) cin >> cost[i]; for (int i = 1; i <= m; i++) cin >> w[i]; for (int i = 0; i < 2 * m; i++) { int a; cin >> a; if (a > 0) { into(a); } else { a = abs(a); if (gar[a] == 0) { for (int j = 0; j < wait.size(); j++) if (wait[j] == a) { wait.erase(wait.begin() + j); break; } } else { av[gar[a]] = 0; if (wait.size() > 0) into(a); } } } cout << income; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Incorrect | 0 ms | 212 KB | Output isn't correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Incorrect | 1 ms | 212 KB | Output isn't correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Incorrect | 1 ms | 212 KB | Output isn't correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Incorrect | 1 ms | 212 KB | Output isn't correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Incorrect | 1 ms | 340 KB | Output isn't correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Incorrect | 1 ms | 340 KB | Output isn't correct |
17 | Incorrect | 1 ms | 212 KB | Output isn't correct |
18 | Incorrect | 1 ms | 340 KB | Output isn't correct |
19 | Incorrect | 1 ms | 340 KB | Output isn't correct |
20 | Incorrect | 1 ms | 340 KB | Output isn't correct |