評分結果(參考) : AC (6ms, 744KB)
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, cnt=0, acCnt=0;
cin >> n;
unordered_map<string, bool> mp;
vector<pair<string, bool>> vt(n);
for(int i=0; i<n; i++){
string res;
cin >> vt[i].first >> res;
vt[i].second = (res == "AC");
}
for(int i=n-1; i>=0; i--){
string name = vt[i].first;
if(vt[i].second){
if(!mp.count(name)) cnt++, acCnt++;
if(mp.count(name) && !mp[name]) acCnt++;
mp[name] = true;
}
else{
if(!mp.count(name)) mp[name] = false;
}
}
cout << 100*cnt/acCnt << "%";
return 0;
}