# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
709666 | 2023-03-14T07:06:16 Z | DarkMatter | Garage (IOI09_garage) | C++17 | 187 ms | 65536 KB |
#define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int>pi; typedef pair<ll, ll>pl; typedef vector<pi>vpi; typedef vector<pl>vpl; typedef vector<vi> vvi; typedef vector<vl> vvl; typedef vector<string> vs; typedef vector<bool> vb; const long double PI = acos(-1); const int oo = 2e9; const int MOD = 998244353; const int N = 2e5 + 7; #define endl '\n' #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define read(v) for (auto& it : v) scanf("%d", &it); #define readL(v) for (auto& it : v) scanf("%lld", &it); #define print(v) for (auto it : v) printf("%d ", it); puts(""); #define printL(v) for (auto it : v) printf("%lld ", it); puts(""); void solve() { int n, m; scanf("%d %d", &n, &m); vl v(n), w(m); vb vis(n); readL(v); readL(w); queue<ll>q; map<int, int>mp; ll ans = 0; for (int i = 0, x; i < 2 * m; i++) { scanf("%d", &x); if (x > 0) q.push(x); else vis[mp[-x]] = false; while (!q.empty()) { int cur = q.front(); bool ok = false; for (int j = 0; j < n; j++) { if (!vis[j]) { vis[j] = ok = true, mp[cur] = j; ans += v[j] * w[cur - 1]; break; } } if (!ok) break; q.pop(); } } printf("%lld\n", ans); } int t = 1; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); #endif //scanf("%d", &t); while (t--) solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 145 ms | 65536 KB | Execution killed with signal 11 |
2 | Runtime error | 176 ms | 65536 KB | Execution killed with signal 11 |
3 | Runtime error | 143 ms | 65536 KB | Execution killed with signal 11 |
4 | Runtime error | 150 ms | 65536 KB | Execution killed with signal 11 |
5 | Runtime error | 143 ms | 65536 KB | Execution killed with signal 11 |
6 | Runtime error | 154 ms | 65536 KB | Execution killed with signal 11 |
7 | Runtime error | 146 ms | 65536 KB | Execution killed with signal 11 |
8 | Runtime error | 151 ms | 65536 KB | Execution killed with signal 11 |
9 | Runtime error | 156 ms | 65536 KB | Execution killed with signal 11 |
10 | Runtime error | 154 ms | 65536 KB | Execution killed with signal 11 |
11 | Runtime error | 149 ms | 65536 KB | Execution killed with signal 11 |
12 | Runtime error | 160 ms | 65536 KB | Execution killed with signal 11 |
13 | Runtime error | 178 ms | 65536 KB | Execution killed with signal 11 |
14 | Runtime error | 159 ms | 65536 KB | Execution killed with signal 11 |
15 | Runtime error | 187 ms | 65536 KB | Execution killed with signal 11 |
16 | Runtime error | 151 ms | 65536 KB | Execution killed with signal 11 |
17 | Runtime error | 144 ms | 65536 KB | Execution killed with signal 11 |
18 | Runtime error | 146 ms | 65536 KB | Execution killed with signal 11 |
19 | Runtime error | 181 ms | 65536 KB | Execution killed with signal 11 |
20 | Runtime error | 146 ms | 65536 KB | Execution killed with signal 11 |