QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#772187#8334. GeneGaze#WA 1544ms21476kbC++141.4kb2024-11-22 17:22:482024-11-22 17:22:48

Judging History

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

  • [2024-11-22 17:22:48]
  • 评测
  • 测评结果:WA
  • 用时:1544ms
  • 内存:21476kb
  • [2024-11-22 17:22:48]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(a,b,c) for(int c(a);c<=(b);++c)
#define drep(a,b,c) for(int c(a);c>=(b);--c)
#define grep(b,c) for(int c(head[b]);c;c=nxt[c])
using namespace std;
inline int read()
{
	int res=0;char ch=getchar();while(ch<'0'||ch>'9')ch=getchar();
	while(ch<='9'&&ch>='0')res=res*10+(ch^48),ch=getchar();return res;
}
unsigned seed=9473573;
inline unsigned rnd()
{
	seed^=seed<<19;
	seed^=seed>>13;
	seed^=seed<<7;
	return seed;
}
typedef unsigned long long ull;
int n,Q,m,K,p[60010];char s[310][60010],t[60010];
string c[310];
void solve() {
	srand(time(0));
	for(int i = 1; i <= n; ++i) {
		cin >> c[i];
	}
	string t;
	for(int i = 1; i <= Q; ++i) {
		int ans = 0;
		cin >> t;
		for(int j = 1; j <= n; ++j) {
			int ti = m / 30, tot = 0;
			while(ti) {
				ti -= 1;
				int x = rand() % m;
				if(t[x] == c[j][x]) continue;
				ans -= 1;
				break;
			}
			ans += 1;
		}
		cout << ans << endl;
	}
}
int main()
{
	
	n=read();Q=read();m=read();K=read();
	
	if(m <= 50000) {
		rep(1,n,i){scanf("%s",s[i]+1);}
		while(Q--)
		{
		scanf("%s",t+1);
		rep(1,m,i)p[i]=i,swap(p[i],p[rnd()%i+1]);
		int ans=0;rep(1,n,i)
		{
			int res=0;bool flag=true;
			rep(1,min(m,3000),j)
			{
				if(s[i][p[j]]==t[p[j]])continue;
				if((++res)>K){flag=false;break;}
			}
			ans+=flag;
		}
		printf("%d\n",ans);
	}
		return 0;
	}
	else {
		solve();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4188kb

input:

6 4 4 1
kaki
kika
manu
nana
tepu
tero
kaka
mana
teri
anan

output:

2
2
1
0

result:

ok 4 number(s): "2 2 1 0"

Test #2:

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

input:

8 6 7 3
delphis
aduncus
peronii
plumbea
clymene
hectori
griseus
electra
delphis
helpiii
perphii
clumeee
eleelea
ddlpcus

output:

1
1
2
2
1
2

result:

ok 6 numbers

Test #3:

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

input:

300 300 9 10
dmzampmxe
bteaudaxb
fjfwhhsfq
btnfzqtyp
ijjrkbyht
hkizlvgdc
ukwsnhiff
hacsdrwyl
fbjabnhst
ktsxbgbtg
jopdbsdsr
yxdxxjltd
daechsouq
klrglgwbn
llzhqzlor
ckdedutfn
lkjxcryoe
zvusjevtz
cevrcdltg
tdmmvvpkj
davfsweem
spcfhcitm
aohsfqrqh
lblehevpj
soaqryimp
tbxlulxmn
tnlzbkhda
ukfhjykuk
eghpuua...

output:

300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
...

result:

ok 300 numbers

Test #4:

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

input:

300 300 10 10
qoecfhznxd
hkoaiunzim
lhtzdmbrjs
vqesfzpiuv
amsgqjxmbq
vptwyshswk
sofrfmsrpf
eplnexhmoh
gcjtqavjga
azytravylz
akpuemdfpq
oxkacujrhg
bsgieguzuo
bojvtfkbdf
pmqmrbceej
zgpfkqfeyx
qkdbfrxqcj
effpkigdcw
kqyqmgjdzr
czlbscrnaq
rymhkenugz
fuybclhlhj
rtmclsdvwy
rhfbfqfrfs
bpemthjxfi
jtcvqyltgj
...

output:

300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
300
...

result:

ok 300 numbers

Test #5:

score: 0
Accepted
time: 4ms
memory: 20412kb

input:

300 300 11 10
lonodhfyrbj
njzuczzviuj
usovdmjfjco
bljtnmsjhut
kkkeybjagck
tbuivwfvjit
qhjzqocsvod
ayobjbagcgv
dudupzsvqpe
tcapottzyte
wdevxapvocr
hsvdfaahndr
jjplhydycgn
srrtpmqmygw
gjjbcchwcur
uivvuqldryj
amlidxfsobz
ofpnwqrzhly
eolqcyidojx
jpiybuplwcf
jmxxtjnwsru
ivkbixrgnph
txjjppqkxgu
vmmbwxmvjd...

output:

96
109
114
108
108
95
108
109
113
106
104
94
111
108
95
107
91
99
111
101
105
116
117
109
106
115
116
96
108
95
114
87
94
116
95
97
104
107
91
103
103
92
115
103
120
102
115
103
101
105
108
95
118
106
91
98
99
115
101
106
120
91
118
91
111
99
104
101
104
96
98
116
111
110
107
118
94
96
103
107
108
1...

result:

ok 300 numbers

Test #6:

score: 0
Accepted
time: 3ms
memory: 20604kb

input:

300 300 11 10
bacdccbdbba
ccabcddcbdc
ddbcccadbab
cbdcabcddbd
ccddbaacaba
addabdbbcba
ccbcbadadac
cbadacadcbb
abddacbcada
ccccbdccdda
dadcbdbddda
acbdccdbcdc
bbbbdbcdcbc
cdcbabdacda
acbcdaaadbc
dccbdcddcca
abbacddccba
cccabdcacda
ddcadbabbca
babaaabbabd
dabdaacaddc
cabcacbdcda
cdbbbdcddcd
cdbdccadda...

output:

287
292
286
279
286
285
289
289
294
284
287
291
287
286
283
275
284
291
289
289
286
291
287
282
290
282
278
288
285
285
285
289
287
283
287
290
287
288
292
288
286
290
290
288
289
285
289
276
286
289
283
279
288
288
288
289
289
286
281
288
291
290
287
289
285
280
289
287
286
295
284
285
286
279
284
...

result:

ok 300 numbers

Test #7:

score: 0
Accepted
time: 10ms
memory: 20632kb

input:

300 300 15 10
bbjbbbjbjbbjjbb
bbjbbbbjbjjjbbb
jbjjjjbjbbjbjbb
bbjjjbjbbjbbjbb
bjbjjjbbbbbbbbb
bjbjbjjjbjjjjjj
bbbjjbbjjjbjjjb
bjbbjbjbjbjjjjj
bbbbbjbjjjjbjbj
bbbjbbbbjbjjjjb
jjjbbbbbbbjjbbj
jbbjjjbbbbjbjbb
bjjbbjbjbjbjjjj
bbjbbjbjbjjbbbb
jbjjjjbbbbjjjbj
bbbbjbbbbbjjbjj
jbjbjjbbjjbjjjb
jjbjbjjbbbjjjj...

output:

279
285
291
281
283
277
281
280
282
280
286
290
279
281
279
286
279
281
279
284
283
279
288
276
288
285
285
278
283
281
284
279
286
283
273
286
286
282
282
288
289
275
279
280
286
288
274
273
280
288
280
283
280
280
285
282
277
282
284
280
284
282
291
280
283
280
288
288
287
275
275
286
286
284
281
...

result:

ok 300 numbers

Test #8:

score: -100
Wrong Answer
time: 1544ms
memory: 21476kb

input:

300 300 59999 10
qfsnaxtgssrzcvtxmwamjekdujnlymqklnmmwqpgmqljtgtgcitmjkinsdsjijxjtxrvhqjxupgryqcyatbjjzvcosvynyyaohyeqkrrqlbwsabqtkbwtkgnyadcpwwqswkokpkjblkfyrdeugvpvzefduxwtxzdnqvflsagkfwtowcjuseqqzbgrnxapdpvnuiwexirodxtmenhmvyafucenakdqwjfsepgawzpfqozzybdbkqoxyverfgtrezznsvwpjeeiahjcaatwbsuoyxwpwi...

output:

198
219
226
213
205
209
226
200
220
215
216
221
216
216
224
216
228
213
225
214
221
221
226
203
226
224
218
221
215
217
217
194
189
215
211
214
215
224
202
211
219
216
225
208
227
207
209
236
207
219
222
213
213
216
232
211
218
209
221
225
213
225
223
227
212
216
215
216
218
210
207
203
215
226
217
...

result:

wrong answer 1st numbers differ - expected: '64', found: '198'