QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#618922#7815. 结构体crazy_monkey0 1ms3652kbC++142.3kb2024-10-07 11:47:462024-10-07 11:47:47

Judging History

你现在查看的是最新测评结果

  • [2024-10-07 11:47:47]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3652kb
  • [2024-10-07 11:47:46]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int n;
map<string,pair<int,int> > mp;
map<string,vector<pair< pair<string,string> , pair<int,int> > > > opr;
bool is[810];
int main()
{
	mp["byte"]={1,1};
	mp["short"]={2,2};
	mp["int"]={4,4};
	mp["long"]={8,8};
	cin >> n;
	for(int i=0;i<n;i++)
	{
		int op;
		cin >> op;
		string lei,num,name;
		int l,dui=0,take=0;
		if(op==1){
			cin >> name >> l;
			take=0;
			dui=0;
			for(int k=0;k<l;k++){
				cin >> lei >> num;
				int bei=1;
				dui=max(dui,mp[lei].second);
				while(is[mp[lei].first*bei]){
					bei++;
				}
				for(int j=mp[lei].first*(bei-1);j<mp[lei].first*bei;j++){
					is[j]==true;
				}
				take=max(take,mp[lei].first*bei);
				opr[name].push_back({make_pair(lei,num),{mp[lei].first*(bei-1),mp[lei].first*bei-1}});
				if(opr[lei].size()>0){
					opr[lei].push_back({make_pair(lei,num),{mp[lei].first*(bei-1),mp[lei].first*bei-1}});
				}
			}
			if(take%dui!=0){
				int k=1;
				while(dui*k<take)k++;
				take=dui*k;
			}
			mp[name]={take,dui};
			cout << take << " " << dui << endl;
		}
		else if(op==2){
			string t,n1;
			cin >> t >> n1;
			int bei=1;
			vector<pair< pair<string,string> , pair<int,int> > > p=opr[t];
			for(int j=0;j<p.size();j++){
				string lei=p[j].first.first;
				bei=1;
				dui=max(dui,mp[lei].second);
				while(is[mp[lei].first*bei]){
					bei++;
				}
				for(int j=mp[lei].first*(bei-1);j<mp[lei].first*bei;j++){
					is[j]==true;
				}
				take=max(take,mp[lei].first*bei);
			}
			int j=0;
			opr[t].push_back({{t,n1},{mp[lei].first*(bei-1),mp[lei].first*bei}});
			opr[n1].push_back({{t,n1},{mp[lei].first*(bei-1),mp[lei].first*bei}});
			while(!is[j])j++;
			cout << j << endl;
		}
		else if(op==3){
			string s;
			cin >> s;
			vector<string> vec;
			string s1="";
			for(int j=0;j<s.size();j++){
				if(s[j]=='.'){
					vec.push_back(s1);
					s1="";
				}
				else{
					s1+=s[j];
				}
			}
			int j=0;
			int ans=0;
			while(j<vec.size())
			{
				for(int k=0;k<opr[vec[j]].size();k++){
					if(opr[vec[j]][k].first.first==vec[j+1]){
						j++;
						if(j==vec.size()){
							ans=opr[vec[j-1]][k].second.first;
						}
					}
				}
			}
			cout << ans << endl;
		}
		else if(op==4){
			long long add;
			cin >> add;
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Pretests


Final Tests

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3652kb

input:

93
2 long gkwc
3 gkwc
2 long omvjdthb
4 1
2 long cumx
3 omvjdthb
4 16
3 gkwc
2 long tebdginn
4 15
4 30
3 omvjdthb
4 22
4 37
2 long nbghbbahln
2 long kkjzl
4 9
3 nbghbbahln
4 31
3 nbghbbahln
3 gkwc
2 long hjzfa
2 long tptemwur
4 39
3 tptemwur
2 long sjybn
4 8
4 15
3 cumx
2 long xathyrnc
4 32
3 xathyr...

output:

849
0
849
849
0
0
849
0
849
849
0
0
0
849
849
0
849
0
849
0
0
849
849
0
0
0
849
849
0
0
0
849
849
849
849
849
0
0
849
0
0
0
0
0
849
849
849
0
849
0
849
0
849
0
0
849
849
0
849
849
849
0
0

result:

wrong answer 1st lines differ - expected: '0', found: '849'

Test #2:

score: 0
Wrong Answer
time: 1ms
memory: 3632kb

input:

100
4 0
4 4
2 byte szqir
2 long fweahddll
2 byte dvqu
3 szqir
2 long wqcnqxppvg
3 szqir
4 9
4 33
3 wqcnqxppvg
4 38
4 5
4 33
2 short erhxh
2 short wwsp
4 3
3 szqir
4 42
2 short pxkwnp
4 15
2 int teuwwrw
4 45
3 erhxh
2 int uuycypz
3 uuycypz
4 48
4 35
4 6
3 wqcnqxppvg
2 byte yvgc
3 yvgc
3 teuwwrw
4 25
...

output:

849
848
848
0
848
0
0
848
848
0
848
848
0
848
0
0
848
0
0
0
0
0
0
0
0
848
0
848
848
848
0
0
0
848
848
0
848
0
848
0
0
848
0
848
0
848
0
848
0
0
848
848
0
848
0
848
0
0
848

result:

wrong answer 1st lines differ - expected: 'ERR', found: '849'

Test #3:

score: 0
Wrong Answer
time: 1ms
memory: 3604kb

input:

99
2 long mrbfn
4 1
3 mrbfn
3 mrbfn
3 mrbfn
3 mrbfn
2 byte oosmberlsb
3 mrbfn
3 oosmberlsb
2 byte auhmoewi
4 7
4 3
2 long jplopgx
4 0
4 31
2 int qqgjpu
2 long plfawkhtd
3 auhmoewi
3 plfawkhtd
2 int uwue
2 long muvlnlgqn
4 46
4 46
4 22
2 long inhosie
3 auhmoewi
3 oosmberlsb
2 byte pziz
2 byte anyxdru...

output:

849
0
0
0
0
849
0
0
849
849
849
849
0
0
849
849
849
0
0
849
849
0
849
849
849
0
849
0
0
0
0
849
0
849
849
0
849
0
0
849
0
0
849
849
849
849
0
849
849
849
0
849
0
0
848
848
0
0
0
848
848
0
848
848
848
848
0

result:

wrong answer 1st lines differ - expected: '0', found: '849'

Test #4:

score: 0
Time Limit Exceeded

input:

99
1 lfqikjtpgg 97
long mbtn
long snpj
long fqb
long vdnkbv
long zqqjxhrj
long upp
long oe
long lv
long sea
long a
long fdymaqnuy
long oyshjkhm
long secuap
long o
long uvq
long xpw
long fsytmbpaaw
long rx
long nhmski
long hzop
long noy
long mqbitjlx
long jewquyks
long auntk
long ak
long bsksgoi
long...

output:

8 8
849

result:


Test #5:

score: 0
Time Limit Exceeded

input:

92
1 stmyil 94
long frzkeaq
long uloz
long khxrakhvl
long mgmigozwpb
long gcmzgib
long tktaj
long ttgattk
long ugnfjyqjei
long qqihkphedp
long jps
long bhdunqh
long qsefx
long iujkjmuolx
long lpyffp
long qryknjg
long utrepva
long dsmu
long qxazh
long nc
long u
long lzslpheclz
long ftjm
long chwf
lon...

output:

8 8
848
848
848

result:


Test #6:

score: 0
Time Limit Exceeded

input:

98
1 mmozfzqkeq 98
byte snth
short p
short ukfuxuar
byte vidqzvet
short mtzfq
byte umfo
short rxzppsvp
short jkcngxzj
byte upvqni
short wnthhncby
byte zzwunbs
short hsmgblo
short ccgvhtx
byte wmru
byte gfhcr
short fwfanwrr
byte wyhihbma
byte rppirq
short nspggyr
short wkntvbwwlv
byte hoqqz
byte fvcn...

output:

2 2
849
0
0
849
849
0
0
848
0
0
0
848
848
848

result:


Test #7:

score: 0
Time Limit Exceeded

input:

92
1 xreiqsyjsl 94
int joqtxmb
byte eobzfc
int yglime
int ghhoizgeq
long kiza
long aef
int ahkehlz
byte kgzpv
long nf
byte hmshwxalu
short tniregati
byte m
short ybauqfo
byte tmtnxog
int etgavrbmqj
short mdirp
int qofuzp
int lzyvpl
int tfdwv
int obskuccugg
byte bgq
short ze
long bpyzngywya
int rcyis...

output:

8 8
848
0
848
848
0
0
848
0
0
848
0
848
848
0
0
848
0
848

result:


Test #8:

score: 0
Time Limit Exceeded

input:

93
1 spkif 90
short klz
short wlbylhewfp
short kyaoz
byte iuszpejqeb
short hlbbgkvnhn
short xwsavtujm
byte pgfwluu
byte mbsh
short ybzxrav
short ilmd
short dvntuiawh
short ucbdcgwkyr
short m
byte qefbom
short rpdiishks
short dbq
byte amiipjf
short rcuw
byte ct
short brdieyded
short snuehuwrbf
byte o...

output:

2 2
848
0
848
848
0
0
848
0
0
848
0
848
848
848
848
848
848
848
0
848
0
0
848
848
848
0
848
0
848
0
848
848

result:


Test #9:

score: 0
Time Limit Exceeded

input:

100
1 tmwddcqr 96
long vc
long bzjxjo
long rpfgxjw
long rwfnwjxezo
long evovfc
long gj
long zwoml
long qtgongwrsf
long qoti
long xoisdmvl
long vkcbsjti
long lyv
long ipjvh
long lmemkym
long zybinjoacb
long xo
long opaxv
long fd
long cheprbq
long vwmixkoa
long qkxjkn
long ty
long ad
long nrrm
long kl...

output:

8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
848
848

result:


Test #10:

score: 0
Time Limit Exceeded

input:

94
1 oeareonbmc 94
long sjlbu
long ddjtxqy
long ac
long rjmwvryp
long bjw
long kjxs
long dns
long wycl
long scucpcfki
long vhotgxwf
long yfgvgw
long xb
long um
long cmcuihmv
long jwyuguj
long dl
long hgecyw
long cn
long xrwhhsqoar
long xfajrvvuy
long pg
long ln
long bwgziqt
long knwn
long mjmz
long ...

output:

8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
848

result:


Test #11:

score: 0
Time Limit Exceeded

input:

100
1 qg 75
short imvphecx
long tgthzzocgy
int z
long rdkrbwqi
long bkzeqx
byte ebcxwfjeka
long ugvjxbayyc
int srjda
long ah
short nhqbw
int twpca
byte hynzjak
long mwrjaitjf
byte qeensxo
short oc
int pniisvwlr
int yvqoaipq
long nwokprd
long pryksxsjti
byte zhbuomugxl
int bgk
byte luo
byte kmimxmj
b...

output:

8 8
8 8
8 8
8 8
2 2
8 8
8 8
8 8
8 8
8 8
8 8
849
8 8

result:


Test #12:

score: 0
Time Limit Exceeded

input:

98
1 prjerge 52
short baiklk
short pdauxtmhcs
long bmutcn
long xhrktulr
short gxqgh
short ylxevjych
short rgd
byte gixpucez
int bbmq
byte giezc
short goonshi
byte pupsmxs
int jmadko
byte lziz
short azfctnm
long pxlp
int lcezuwix
int pwcmndzare
int isjkucax
int tngygloe
int vjcs
int dbcsddgz
short ct...

output:

8 8
8 8
8 8
2 2
1 1
2 2
4 4
8 8
8 8
8 8
849
849
8 8
8 8
849
849
849
8 8
849
849
0
849

result:


Test #13:

score: 0
Time Limit Exceeded

input:

95
1 icyrswqfl 93
short qffx
byte lkojhr
long hhsbxdps
long gcsi
long hiznsou
short hjwpmzywv
int hhxyuk
byte vrudbiwl
byte cqmcxfx
long jzdrah
int uafucqu
int gwixgsyfa
short ezyti
long iczdyjxa
short tc
short vyvozoirs
long m
int kpmg
short ecxfhjhfu
short gwdqiiza
int yfjmrewujt
int hl
long t
lon...

output:

8 8
8 8
8 8
8 8
2 2
8 8
8 8
8 8
8 8
8 8
849

result:


Test #14:

score: 0
Time Limit Exceeded

input:

93
1 rrcruvb 100
long gbrpkh
long o
long npx
long fqbwyv
long cer
long xtmxwgset
long slohh
long r
long kkljaga
long wkesor
long belhrmxthz
long bw
long vx
long wfqc
long nqdvlk
long v
long mlgm
long hioyoss
long rhpyhqr
long troazjcq
long got
long mxkp
long nwayf
long qofxrrhp
long ttskfndao
long j...

output:

8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
848

result:


Test #15:

score: 0
Time Limit Exceeded

input:

92
1 mfqfaoi 51
long vgiijn
long kqvmcutd
long kkqmfdmdsg
long we
long h
long lx
long bdzy
long tqb
long ayybs
long iefznflod
long qjw
long xq
long hajgbfpuqj
long otlrrbqpy
long xpxyro
long lum
long umizkapzp
long jxjjgsuab
long aesd
long redlyai
long htpfoi
long eyo
long hkc
long hb
long wwt
long ...

output:

8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
849

result:


Test #16:

score: 0
Time Limit Exceeded

input:

92
1 itmex 54
long qlmtjv
long eoiw
long ef
long imfhgcc
long cvvwlhqj
long pwrrrcarid
long ejs
long v
long cjl
long qfhsxdx
long opqhk
long rtyfmpb
long cgefjpnsyj
long oaovfhc
long vun
long thwqf
long hhdrhsizr
long ckwl
long gaxdzp
long mwcw
long knjp
long zcemzmfs
long zlnjmriio
long oein
long s...

output:

8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
8 8
848

result:


Test #17:

score: 0
Time Limit Exceeded

input:

94
1 gzvgm 96
int ozzmlzdcs
short lzf
int tc
int cpagll
byte jktmts
long qtsyn
long rfyehp
int dmfpk
byte dourj
byte aoqijd
short er
int aykwg
byte bozawefpt
short kodpn
short lk
byte xxem
byte cvo
long vdowzxhn
short rutrrcfua
short wev
short wnkufo
byte hvo
int ovnbmuq
long rcx
short ngtdtdxt
byte...

output:

8 8
1 1
8 8
2 2
8 8
8 8
4 4
8 8
8 8
1 1
848
8 8

result:


Test #18:

score: 0
Time Limit Exceeded

input:

92
1 pyrj 59
short qjazriblv
int udo
long ifisemk
int inso
byte lpmnuevtab
int ilrtum
byte aucf
byte qvwxbxcevi
long sxboxvu
byte rjfpvq
byte iteamtvj
int lrsf
short nnbnd
long ndiwpi
short hvcpdhh
short rqmusonxma
short agoriisqdu
short jqskvkw
short qyq
long zvmpxd
byte mbb
long kpabhzk
int qktde
...

output:

8 8
1 1
8 8
8 8
2 2
8 8
8 8
8 8
8 8
1 1
849
0
849

result:


Test #19:

score: 0
Time Limit Exceeded

input:

100
1 deam 92
int puxuhin
byte qzbt
byte oelfvt
short qjhpt
short zvmv
byte hmdzptx
long mctwgosxff
short uygqtcthn
long ykshnocnt
int ybsvabraeu
int qzwh
long brrtu
byte fide
byte lisonhykl
short pmsend
byte dhqyw
short rso
long vmuhoz
byte kasnh
long lyjjfblrb
short uzsagojr
byte odqcqtjcvs
byte m...

output:

8 8
4 4
4 4
8 8
8 8
8 8
8 8
4 4
8 8
8 8
848

result:


Test #20:

score: 0
Time Limit Exceeded

input:

100
1 vmtrvlmprp 99
byte hbvh
long ifeouvbu
long ylh
long hqgw
int wcs
short oavgeme
byte ppmssx
byte prdykjzgw
byte obta
short yzf
byte ozqfbozj
short vuypsqhd
byte anwbcc
byte iiungtbs
short dkhape
byte ixh
short gbdm
long ijrczrv
short rgkc
short amskm
short jguttrfv
short dotlif
byte tqvwccaafx
...

output:

8 8
1 1
8 8
4 4
8 8
2 2
8 8
4 4
8 8
8 8
8 8
4 4
8 8
848
848

result: