| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1352535 | hsuan._.0528 | Inflation (EGOI23_inflation) | C++20 | 223 ms | 24300 KiB |
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pii pair<LL, LL>
#define S second
#define F first
const int maxn = 3e5;
int n, q;
LL h=0, ans=0;
LL p[maxn];
set<pii> st;
map<LL, int> mp;
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>n;
for(int i=1; i<=n; i++){
cin>>p[i];
ans+=p[i];
mp[ p[i] ]++;
}
cin>>q;
while(q--){
string s;
LL x, y;
cin>>s;
if(s=="INFLATION"){
cin>>x;
h+=x;
}else if(s=="SET"){
cin>>x>>y;
if(x!=y){
int now = mp[x-h];
ans -= (x-h) * now;
ans += (y-h) * now;
mp[y-h] += now;
mp[x-h] = 0;
}
}
cout<<ans+h*n<<"\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... | ||||
