QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#276937#6821. Another A+B ProblemsurenjamtsWA 2ms3836kbC++172.8kb2023-12-06 13:24:042023-12-06 13:24:06

Judging History

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

  • [2023-12-06 13:24:06]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3836kb
  • [2023-12-06 13:24:04]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define S second
#define F first
int main(){
	ios_base::sync_with_stdio(NULL);
	cin.tie(NULL);
	cout.tie(NULL);
	string s,t;
	cin>>s>>t;
	map < char, ll > purple, black;
	map < char, ll > ::iterator it;
	for(int i = 0; i < t.size(); i ++ ){
		if( t[i] == 'P' ){
			purple[ s[i] ] ++;
		}
		if( t[i] == 'B' ){
			black[ s[i] ] ++;  
		}
	}
	vector < string > ans;
	for(int i=0; i<10; i++){
		for(int j=0; j<10; j++){
			for(int i1=0; i1<10; i1++){
				for(int j1=0; j1<10; j1++){
					for(int i2=0; i2<10; i2++){
						for(int j2=0; j2<10; j2++){
							//tentsuu bnu
							map < char, ll > curr_p;
							curr_p.clear();
							if(i*10+j+i1*10+j1!=i2*10+j2) continue;
							bool yes=1;
							//greenee shalgasan
							string w="";
							w+='0'+i;
							w+='0'+j;
							w+='+';
							w+='0'+i1;
							w+='0'+j1;
							w+='=';
							w+='0'+i2;
							w+='0'+j2;
							for(int k=0; k<t.size(); k++){
								if(t[k]=='G'){
									if(s[k]!=w[k]) yes=0;
								}
							}
							if(!yes) continue;
//							for(int k=0; k<t.size(); k++){
//								if(t[k]=='P'){
//									if(w[k]==s[k]){
//										yes=0;
//									}
//								}	
//							}
//							if(!yes) continue;
							bool flag = true;
							for(int k=0; k < t.size(); k ++ ){
								if( t[k] == 'B' ){
									if( s[k] == w[k] ){
										flag = false;
										break;
									}
								}
							}
							if( flag == false ){
								continue;
							}
							flag = true;
							for(int k = 0; k< t.size(); k ++ ){
								if( t[k] == 'P' ){
									if( s[k] == w[k] ){
										flag = false;
										break;
									}
								}
							}
							if( flag == false )
								continue;
							flag = true;
							for(int k = 0; k < w.size(); k ++ ){
								if( t[k] != 'G' )
									curr_p[w[k]] ++;
							}	
							for( it = purple.begin(); it != purple.end(); it ++ ){
								if( black[ it->F ] != 0 ){
									if( curr_p[ it->F ] != it->S ){
										flag = false;
										break;
									}
								}else{
									if( curr_p[ it->F ] < it->S ){
										flag = false;
										break;
									}
								}
							}
							if(flag == false )
								continue;
							flag = true;
							for( it = black.begin(); it != black.end(); it ++ ){
								if( purple[ it->F ] == 0 ){
									for(int k = 0; k < w.size(); k ++ ){
										if( w[k] == it->F ){
											flag = false;
											break;
										}
									}
								}
							}
							if( flag == false )
								continue;
							ans.pb( w );
						}
					}
				}
			}
		}
	}	
	cout << ans.size() << "\n";
	for(int i = 0; i < ans.size(); i ++ )
		cout << ans[i] << "\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3488kb

input:

40+11=51
PBGPPGGB

output:

7
11+42=53
11+43=54
11+44=55
11+45=56
11+46=57
11+47=58
11+48=59

result:

ok ans=7

Test #2:

score: 0
Accepted
time: 1ms
memory: 3752kb

input:

12+46=58
GBGGPGGB

output:

6
11+45=56
13+43=56
15+41=56
16+40=56
16+41=57
16+43=59

result:

ok ans=6

Test #3:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

11+22=33
PBGPPGGP

output:

1
22+13=35

result:

ok ans=1

Test #4:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

11+22=33
BPGPPGGP

output:

1
22+13=35

result:

ok ans=1

Test #5:

score: 0
Accepted
time: 2ms
memory: 3612kb

input:

01+02=03
PPGPPGPP

output:

2
10+20=30
20+10=30

result:

ok ans=2

Test #6:

score: 0
Accepted
time: 2ms
memory: 3756kb

input:

00+00=00
BBGBBGBB

output:

2304
11+11=22
11+12=23
11+13=24
11+14=25
11+15=26
11+16=27
11+17=28
11+18=29
11+21=32
11+22=33
11+23=34
11+24=35
11+25=36
11+26=37
11+27=38
11+28=39
11+31=42
11+32=43
11+33=44
11+34=45
11+35=46
11+36=47
11+37=48
11+38=49
11+41=52
11+42=53
11+43=54
11+44=55
11+45=56
11+46=57
11+47=58
11+48=59
11+51=6...

result:

ok ans=2304

Test #7:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

44+44=88
BBGBBGBB

output:

1441
00+00=00
00+01=01
00+02=02
00+03=03
00+05=05
00+06=06
00+07=07
00+09=09
00+10=10
00+11=11
00+12=12
00+13=13
00+15=15
00+16=16
00+17=17
00+19=19
00+20=20
00+21=21
00+22=22
00+23=23
00+25=25
00+26=26
00+27=27
00+29=29
00+30=30
00+31=31
00+32=32
00+33=33
00+35=35
00+36=36
00+37=37
00+39=39
00+50=5...

result:

ok ans=1441

Test #8:

score: 0
Accepted
time: 1ms
memory: 3828kb

input:

23+45=68
GGGGGGGG

output:

1
23+45=68

result:

ok ans=1

Test #9:

score: 0
Accepted
time: 1ms
memory: 3524kb

input:

09+71=80
GBGBBGBG

output:

18
00+00=00
00+20=20
00+30=30
00+40=40
00+50=50
00+60=60
04+26=30
04+36=40
04+46=50
04+56=60
05+25=30
05+35=40
05+45=50
05+55=60
06+24=30
06+34=40
06+44=50
06+54=60

result:

ok ans=18

Test #10:

score: 0
Accepted
time: 2ms
memory: 3532kb

input:

37+52=89
BPGBPGPP

output:

34
08+19=27
09+18=27
12+78=90
14+78=92
18+09=27
18+29=47
18+74=92
19+08=27
19+28=47
20+78=98
21+77=98
22+76=98
24+74=98
28+19=47
28+49=77
28+69=97
28+70=98
29+18=47
29+48=77
29+49=78
29+68=97
48+29=77
49+28=77
49+29=78
68+29=97
69+28=97
70+28=98
71+27=98
72+18=90
72+26=98
74+18=92
74+24=98
78+14=92
...

result:

ok ans=34

Test #11:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

57+26=83
PBGGPGBP

output:

18
06+25=31
06+29=35
11+25=36
15+21=36
31+25=56
32+24=56
33+23=56
34+22=56
35+21=56
35+25=60
35+29=64
36+20=56
36+23=59
36+25=61
36+29=65
39+25=64
42+23=65
43+22=65

result:

ok ans=18

Test #12:

score: 0
Accepted
time: 2ms
memory: 3608kb

input:

41+11=52
PPGBBGBB

output:

98
03+38=41
04+06=10
04+09=13
04+37=41
04+67=71
04+77=81
04+87=91
06+04=10
06+08=14
07+07=14
07+34=41
07+64=71
07+74=81
07+84=91
08+06=14
08+33=41
09+04=13
10+30=40
10+33=43
10+34=44
10+36=46
10+37=47
10+38=48
10+39=49
10+64=74
10+74=84
10+84=94
13+30=43
13+33=46
13+34=47
13+36=49
13+47=60
13+64=77
...

result:

ok ans=98

Test #13:

score: 0
Accepted
time: 2ms
memory: 3836kb

input:

08+41=49
PPGBPGBB

output:

76
10+08=18
10+18=28
10+28=38
10+58=68
10+68=78
10+70=80
10+72=82
10+73=83
10+75=85
10+76=86
10+77=87
10+78=88
11+07=18
11+70=81
12+06=18
12+08=20
12+18=30
12+38=50
12+58=70
12+68=80
12+70=82
13+05=18
13+08=21
13+67=80
13+70=83
15+03=18
15+08=23
15+65=80
15+70=85
16+02=18
16+70=86
17+08=25
17+63=80
...

result:

ok ans=76

Test #14:

score: 0
Accepted
time: 2ms
memory: 3540kb

input:

30+28=58
BPGPBGPB

output:

82
02+05=07
02+15=17
02+45=47
02+59=61
02+65=67
02+75=77
02+95=97
05+02=07
05+07=12
05+12=17
05+15=20
05+16=21
05+17=22
05+19=24
05+42=47
05+57=62
05+62=67
05+67=72
05+72=77
05+92=97
06+15=21
06+19=25
06+56=62
07+05=12
07+15=22
07+55=62
07+65=72
09+15=24
09+16=25
09+52=61
12+05=17
12+50=62
15+02=17
...

result:

ok ans=82

Test #15:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

14+04=18
BGGBPGBB

output:

24
24+22=46
24+23=47
24+25=49
24+42=66
24+43=67
24+45=69
24+49=73
34+42=76
34+43=77
34+45=79
44+22=66
44+23=67
44+25=69
44+29=73
44+32=76
44+33=77
44+35=79
44+49=93
44+52=96
44+53=97
44+55=99
54+42=96
54+43=97
54+45=99

result:

ok ans=24

Test #16:

score: 0
Accepted
time: 2ms
memory: 3776kb

input:

48+35=83
BBGPBGBB

output:

144
01+29=30
02+29=31
03+06=09
03+07=10
03+09=12
03+16=19
03+17=20
03+19=22
03+26=29
03+66=69
03+67=70
03+69=72
03+76=79
03+96=99
06+03=09
06+13=19
06+23=29
06+26=32
06+63=69
06+73=79
06+93=99
07+03=10
07+13=20
07+29=36
07+63=70
09+03=12
09+13=22
09+21=30
09+22=31
09+27=36
09+63=72
10+20=30
10+21=31...

result:

ok ans=144

Test #17:

score: 0
Accepted
time: 1ms
memory: 3484kb

input:

29+61=90
BPGBGGBB

output:

11
18+31=49
18+41=59
18+71=89
38+11=49
38+41=79
38+51=89
48+11=59
48+31=79
48+41=89
58+31=89
78+11=89

result:

ok ans=11

Test #18:

score: 0
Accepted
time: 2ms
memory: 3608kb

input:

32+29=61
BBGBBGBP

output:

136
00+10=10
00+14=14
00+15=15
00+17=17
00+18=18
01+04=05
01+07=08
01+14=15
01+17=18
01+44=45
01+47=48
01+54=55
01+57=58
01+74=75
01+77=78
01+84=85
01+87=88
04+01=05
04+10=14
04+11=15
04+14=18
04+41=45
04+51=55
04+71=75
04+81=85
05+05=10
05+10=15
07+01=08
07+07=14
07+08=15
07+10=17
07+11=18
07+41=48...

result:

ok ans=136

Test #19:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

38+16=54
BPGBPGPG

output:

4
06+58=64
26+58=84
56+08=64
56+28=84

result:

ok ans=4

Test #20:

score: 0
Accepted
time: 0ms
memory: 3488kb

input:

72+11=83
GBGBBGGB

output:

18
74+06=80
75+05=80
75+09=84
76+04=80
76+08=84
76+09=85
77+07=84
77+08=85
77+09=86
78+06=84
78+07=85
78+08=86
78+09=87
79+05=84
79+06=85
79+07=86
79+08=87
79+09=88

result:

ok ans=18

Test #21:

score: 0
Accepted
time: 2ms
memory: 3600kb

input:

42+36=78
PBGPBGPP

output:

35
03+84=87
04+79=83
04+83=87
09+74=83
11+73=84
13+71=84
13+74=87
13+84=97
14+73=87
14+83=97
33+47=80
33+54=87
34+47=81
34+53=87
37+08=45
37+43=80
37+44=81
37+47=84
37+48=85
38+07=45
38+09=47
38+47=85
38+49=87
39+08=47
39+48=87
71+13=84
73+11=84
73+14=87
74+09=83
74+13=87
79+04=83
83+04=87
83+14=97
...

result:

ok ans=35

Test #22:

score: 0
Accepted
time: 2ms
memory: 3788kb

input:

29+44=73
BBGBBGPB

output:

122
00+07=07
00+17=17
00+57=57
00+67=67
00+87=87
01+06=07
01+07=08
01+16=17
01+17=18
01+56=57
01+57=58
01+66=67
01+67=68
01+86=87
01+87=88
05+75=80
05+76=81
06+01=07
06+11=17
06+51=57
06+61=67
06+75=81
06+81=87
07+00=07
07+01=08
07+08=15
07+10=17
07+11=18
07+50=57
07+51=58
07+58=65
07+60=67
07+61=68...

result:

ok ans=122

Test #23:

score: 0
Accepted
time: 1ms
memory: 3604kb

input:

41+01=42
PBGGBGBB

output:

64
03+04=07
04+03=07
04+05=09
05+04=09
33+04=37
34+03=37
34+05=39
35+04=39
53+04=57
54+03=57
54+05=59
54+06=60
54+09=63
55+04=59
55+09=64
56+04=60
56+08=64
57+07=64
58+06=64
59+04=63
59+05=64
63+04=67
64+03=67
64+05=69
64+06=70
64+09=73
65+04=69
65+09=74
66+04=70
66+08=74
67+07=74
68+06=74
69+04=73
...

result:

ok ans=64

Test #24:

score: 0
Accepted
time: 1ms
memory: 3536kb

input:

51+44=95
BPGPBGGB

output:

32
03+91=94
04+87=91
12+82=94
13+81=94
14+76=90
14+77=91
14+78=92
14+79=93
14+82=96
14+83=97
16+78=94
17+77=94
18+76=94
23+71=94
24+67=91
33+61=94
63+31=94
64+27=91
73+21=94
74+16=90
74+17=91
74+18=92
74+19=93
76+18=94
77+17=94
78+16=94
82+12=94
83+11=94
84+07=91
84+12=96
84+13=97
93+01=94

result:

ok ans=32

Test #25:

score: 0
Accepted
time: 1ms
memory: 3536kb

input:

21+67=88
GGGBPGBB

output:

11
21+49=70
21+50=71
21+51=72
21+52=73
21+53=74
21+54=75
21+70=91
21+71=92
21+72=93
21+73=94
21+74=95

result:

ok ans=11

Test #26:

score: 0
Accepted
time: 0ms
memory: 3748kb

input:

45+33=78
BBGPBGPB

output:

55
03+07=10
03+17=20
06+07=13
06+17=23
07+06=13
07+16=23
07+29=36
09+27=36
10+27=37
11+26=37
12+27=39
13+07=20
13+77=90
13+79=92
16+07=23
16+21=37
16+77=93
17+06=23
17+19=36
17+20=37
17+22=39
17+76=93
19+17=36
20+17=37
21+16=37
21+72=93
22+17=39
22+71=93
23+67=90
23+76=99
26+11=37
26+67=93
27+09=36
...

result:

ok ans=55

Test #27:

score: 0
Accepted
time: 2ms
memory: 3788kb

input:

09+69=78
BPGPBGBP

output:

50
11+58=69
11+85=96
12+84=96
13+83=96
14+82=96
15+81=96
18+51=69
21+48=69
28+41=69
31+38=69
33+56=89
36+53=89
36+58=94
38+31=69
38+56=94
38+58=96
41+28=69
43+46=89
46+43=89
46+48=94
48+21=69
48+46=94
48+48=96
51+18=69
53+36=89
56+33=89
56+38=94
58+11=69
58+36=94
58+38=96
61+28=89
63+26=89
63+28=91
...

result:

ok ans=50

Test #28:

score: 0
Accepted
time: 1ms
memory: 3536kb

input:

11+39=50
BPGPBGGP

output:

10
02+51=53
03+48=51
03+51=54
08+43=51
40+13=53
43+08=51
43+10=53
48+03=51
52+01=53
53+01=54

result:

ok ans=10

Test #29:

score: 0
Accepted
time: 2ms
memory: 3568kb

input:

39+00=39
BBGBBGBB

output:

484
11+11=22
11+14=25
11+15=26
11+16=27
11+17=28
11+41=52
11+44=55
11+45=56
11+46=57
11+47=58
11+51=62
11+54=65
11+55=66
11+56=67
11+57=68
11+61=72
11+64=75
11+65=76
11+66=77
11+67=78
11+71=82
11+74=85
11+75=86
11+76=87
11+77=88
12+12=24
12+14=26
12+15=27
12+16=28
12+42=54
12+44=56
12+45=57
12+46=58...

result:

ok ans=484

Test #30:

score: -100
Wrong Answer
time: 1ms
memory: 3784kb

input:

74+23=97
BBGBPGGG

output:

0

result:

wrong answer Jury has 8 answers but participant has 0