| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1355051 | AMel0n | Inflation (EGOI23_inflation) | C++20 | 188 ms | 14592 KiB |
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define rep(N) for(int i=0;i<N;++i)
#define ll long long
#define int long long
#define pi pair<int,int>
#define vi vector<int>
#define F first
#define S second
#define gotta_go_fast cin.tie(0); ios_base::sync_with_stdio(0);
int N, Q;
int a;
signed main() {
cin >> N;
unordered_map<int,int> q; // val, amount
int res = 0;
rep(N) {
cin >> a;
q[a]++;
res += a;
}
cin >> Q;
string instr;
int x, y;
int inflation = 0;
rep(Q) {
cin >> instr;
if (instr == "INFLATION") {
cin >> x;
res += N * x;
inflation += x;
}
else if (instr == "SET") {
cin >> x >> y;
x -= inflation; y -= inflation;
if (x != y) {
q[y] += q[x];
res += (q[x]) * (y-x);
q[x] = 0;
}
}
cout << res << endl;
// for (auto a = q.begin(); a != q.end(); ++a) {
// cout << a->first << ' ' << a->second << " | ";
// }
// cout << endl;
}
return 0;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
