全部RE了
#include <bits/stdc++.h>
using namespace std;
int T;
unordered_map<string,pair<long long,long long> > m;
int main(){
// freopen("struct.in","r",stdin);
// freopen("struct.out","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>T;
m["byte"]=make_pair(1ll,1ll);
m["int"]=make_pair(4ll,4ll);
m["short"]=make_pair(2ll,2ll);
m["long"]=make_pair(8ll,8ll);
while(T--){
long long opt,k,lst=0ll,maxn=0ll;
string s,name,tmp;
cin>>opt>>s>>k;
cin>>name>>tmp;
lst=m[name].first;
maxn=m[name].second;
for(int i=2;i<=k;i++){
cin>>name>>tmp;
lst=(lst/m[name].second+(lst%m[name].second!=0))*m[name].second;
lst+=m[name].first;
maxn=max(maxn,m[name].second);
}
lst=(lst/maxn+(lst%maxn!=0))*maxn;
m[s]=make_pair(lst,maxn);
cout<<lst<<' '<<maxn<<'\n';
}
return 0;
}