| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1352536 | hsuan._.0528 | Inflation (EGOI23_inflation) | C++20 | 311 ms | 20764 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, LL> 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;
LL now = mp[x-h];
if(x!=y and now){
ans -= (x-h) * now;
ans += (y-h) * now;
mp[y-h] += now;
mp.erase(x-h);
}
}
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... | ||||
