Logo Wy Online Judge

WyOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#240#6. 「WyOJ Round 1」持 · 山海为肩lgvc104526ms238112kbC++231.4kb2025-04-18 14:27:142025-04-18 18:01:14

answer

#include <bits/stdc++.h>
double vq[600009][25],tp[600009][25];
int N,M,p[15];
inline int gt() {
	char s[10];scanf("%s",s);
	if(s[0]=='r') return 0;
	if(s[0]=='p') return 1;
	if(s[0]=='s') return 2;
}
signed main(void) {
	scanf("%d %d",&N,&M);
	for(int i=1;i<=N;i++) {
		double qq;
		scanf("%lf",&qq);
		int gg=0;
		for(int j=1;j<=M;j++) {
			gg=gg*3+gt();
		}
		vq[gg][M]+=qq;
	}
	p[0]=1;
	for(int i=1;i<=M;i++) p[i]=p[i-1]*3;
	for(int i=0;i<M;i++) {
		for(int j=0;j<p[M];j+=p[i+1]) {
			for(int k=j;k<j+p[i];k++) {
				int rock=k;
				int pap=k+p[i];
				int sci=k+p[i]*2;
				for(int l=M-i;l<=M+i;l++) {
						tp[pap][l+1]+=vq[rock][l];
						tp[rock][l]+=vq[rock][l];
						tp[sci][l-1]+=vq[rock][l];
						tp[sci][l+1]+=vq[pap][l];
						tp[pap][l]+=vq[pap][l];
						tp[rock][l-1]+=vq[pap][l];
						tp[rock][l+1]+=vq[sci][l];
						tp[sci][l]+=vq[sci][l];
						tp[pap][l-1]+=vq[sci][l];
				}
			}
		}
		memcpy(vq,tp,sizeof(vq));
		memset(tp,0,sizeof(tp));
	}
	double ans=0;
	for(int i=0;i<p[M];i++) {
		double su=0;
		for(int j=M;j<=2*M;j++) {
			su+=vq[i][j];
		}
		ans=std::max(ans,su);
	}
	printf("%.6lf\n",ans);
	for(int i=0;i<p[M];i++) {
		double su=0;
		for(int j=M;j<=2*M;j++) {
			su+=vq[i][j];
		}
		if(su==ans) {
			for(int k=0;k<M;k++) {
				int ww=i/p[M-k-1]%3;
				if(ww==0) printf("rock ");
				if(ww==1) printf("paper ");
				if(ww==2) printf("scissors ");
			}
			return 0;
		}
	}

}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 0
Wrong Answer
time: 141ms
memory: 238104kb

input:

841 5
0.002262 paper rock rock scissors scissors
0.000665 rock paper paper scissors paper
0.001132 s...

output:

0.689135

result:

wrong answer Unexpected EOF in the participants output

Test #2:

score: 10
Accepted
time: 33ms
memory: 237784kb

input:

320 1
0.001734 rock
0.000432 rock
0.003306 scissors
0.000322 paper
0.000380 rock
0.000817 scissors
0...

output:

0.728099
rock 

result:

ok 2 tokens

Test #3:

score: 0
Wrong Answer
time: 66ms
memory: 238112kb

input:

19 2
0.086520 scissors rock
0.028985 rock rock
0.056406 rock scissors
0.010732 scissors rock
0.04471...

output:

0.836348

result:

wrong answer Unexpected EOF in the participants output

Test #4:

score: 0
Wrong Answer
time: 760ms
memory: 237976kb

input:

100000 12
0.000008 rock rock rock scissors paper scissors paper paper paper scissors paper scissors
...

output:

0.578764

result:

wrong answer Unexpected EOF in the participants output

Test #5:

score: 0
Wrong Answer
time: 514ms
memory: 237920kb

input:

82918 11
0.000009 paper rock rock scissors scissors paper rock paper rock rock paper
0.000000 scisso...

output:

0.582727

result:

wrong answer Unexpected EOF in the participants output

Test #6:

score: 0
Wrong Answer
time: 394ms
memory: 238112kb

input:

63157 10
0.000004 rock scissors paper scissors paper scissors rock paper rock scissors
0.000007 rock...

output:

0.587712

result:

wrong answer Unexpected EOF in the participants output

Test #7:

score: 0
Wrong Answer
time: 730ms
memory: 237724kb

input:

100000 12
0.000003 rock rock rock paper paper rock paper paper paper rock rock scissors
0.000001 pap...

output:

0.578665

result:

wrong answer Unexpected EOF in the participants output

Test #8:

score: 0
Wrong Answer
time: 523ms
memory: 237784kb

input:

72055 11
0.000006 rock scissors scissors rock scissors scissors scissors scissors rock scissors scis...

output:

0.584229

result:

wrong answer Unexpected EOF in the participants output

Test #9:

score: 0
Wrong Answer
time: 644ms
memory: 237916kb

input:

49463 12
0.000024 rock paper scissors paper rock scissors rock paper paper paper paper paper
0.00000...

output:

0.584658

result:

wrong answer Unexpected EOF in the participants output

Test #10:

score: 0
Wrong Answer
time: 721ms
memory: 237920kb

input:

100000 12
0.000007 rock paper scissors paper paper scissors rock rock scissors rock scissors paper
0...

output:

0.578092

result:

wrong answer Unexpected EOF in the participants output