| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1329826 | model_code | Inflation (EGOI23_inflation) | C++20 | 87 ms | 12944 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin >> N;
unordered_map<long long, long long> freq;
long long s = 0, g = 0;
for (int i = 0; i < N; i++) {
long long p;
cin >> p;
freq[p]++;
s += p;
}
int Q;
cin >> Q;
for (int q = 0; q < Q; q++) {
string type;
cin >> type;
if (type == "INFLATION") {
long long x;
cin >> x;
g += x;
} else {
long long x, y;
cin >> x >> y;
x -= g;
y -= g;
if (x != y && freq.count(x) && freq[x] > 0) {
s += freq[x] * (y - x);
freq[y] += freq[x];
freq.erase(x);
}
}
cout << s + (long long)N * g << '\n';
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
