QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#630009#5140. Frozen Scoreboard999#WA 2ms3948kbC++141.3kb2024-10-11 15:57:092024-10-11 15:57:15

Judging History

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

  • [2024-10-11 15:57:15]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3948kb
  • [2024-10-11 15:57:09]
  • 提交

answer

#include<bits/stdc++.h>
#define For(a,b,c) for(int a=b;a<=c;++a)
#define Dor(a,b,c) for(int a=b;a>=c;--a)
#define CC(_...) fprintf(stderr,_)
using namespace std;
typedef long long LL;
int T,m,c,h,L[15],R[15],Y[15],Z[15];
char O[15][100];
void magic() {
	scanf("%d%d\n",&c,&h);
	int tn=0;
	For(i,1,m) {
		fgets(O[i],99,stdin);
		if(*O[i]=='.') continue;
		if(*O[i]=='+') {
			int x,y;
			sscanf(O[i],"%*s%d/%d",&x,&y);
			--c,h-=y+(x-1)*20;
		}
		if(*O[i]=='-') continue;
		if(*O[i]=='?') {
			int x,y;
			sscanf(O[i],"%*s%d%d",&x,&y);
			L[tn]=(y-x)*20,R[tn]=59+(y-1)*20,Y[tn]=y-x,Z[tn]=x-1;
			++tn;
		}
	}
	h-=c*240;
	if(c<0||h<0) {
		puts("No");
		return;
	}
	For(i,0,(1<<tn)-1) {
		int cc=0,l=0,r=0;
		For(j,0,tn-1)
		if(i&1<<j) {
			++cc;
			l+=L[j],r+=R[j];
		}
		if(cc==c&&l<=h&&h<=r) {
			puts("Yes");
			For(j,0,tn-1)
			if(i&1<<j) {
				h-=L[j],R[j]-=L[j];
			}
			int nt=0;
			For(j,1,m) {
				if(*O[j]!='?') {
					printf("%s",O[j]);
					continue;
				}
				if(i&1<<nt) {
					int t=min(h,R[nt]);
					int c=min(t/20,Z[nt]);
					printf("+ %d/%d\n",Y[nt]+c+1,240+t-c*20);
				}
				else printf("- %d\n",Y[nt]+Z[nt]+1);
				++nt;
			}
			return;
		}
	}
	puts("No");
}
int main() {
	scanf("%d%d",&T,&m);
	For(i,1,T) magic();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 13
7 951
+ 1/6
? 3 4
+ 4/183
- 2
+ 3/217
.
.
.
+ 2/29
+ 1/91
.
+ 1/22
.

output:

Yes
+ 1/6
+ 3/243
+ 4/183
- 2
+ 3/217
.
.
.
+ 2/29
+ 1/91
.
+ 1/22
.

result:

ok ok (1 test case)

Test #2:

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

input:

6 2
1 100
.
? 3 4
2 100
+ 1/1
+ 1/2
0 0
- 5
- 6
2 480
? 100 100
? 100 100
2 480
? 99 100
? 100 100
1 2000
? 100 100
? 100 100

output:

No
No
Yes
- 5
- 6
Yes
+ 1/240
+ 1/240
No
Yes
+ 89/240
- 100

result:

ok ok (6 test cases)

Test #3:

score: -100
Wrong Answer
time: 2ms
memory: 3908kb

input:

1000 13
6 1519
+ 3/183
- 1
+ 9/133
? 2 3
- 5
? 1 3
- 5
? 1 1
? 1 3
- 5
+ 1/165
- 6
? 2 5
2 570
- 2
- 9
.
- 1
- 7
- 6
+ 4/179
- 2
? 2 5
.
- 2
? 1 3
.
1 140
.
- 2
.
- 2
- 1
- 2
- 2
.
.
.
.
+ 3/100
.
1 195
+ 1/195
.
.
.
.
.
.
.
.
? 1 1
.
.
.
0 0
.
.
.
.
.
.
.
.
.
.
.
.
.
3 776
? 8 22
? 1 8
- 6
+ 1/173
...

output:

Yes
+ 3/183
- 1
+ 9/133
+ 3/278
- 5
+ 3/298
- 5
+ 1/298
- 3
- 5
+ 1/165
- 6
- 5
Yes
- 2
- 9
.
- 1
- 7
- 6
+ 4/179
- 2
+ 5/251
.
- 2
- 3
.
Yes
.
- 2
.
- 2
- 1
- 2
- 2
.
.
.
.
+ 3/100
.
Yes
+ 1/195
.
.
.
.
.
.
.
.
- 1
.
.
.
Yes
.
.
.
.
.
.
.
.
.
.
.
.
.
Yes
- 22
- 8
- 6
+ 1/173
- 11
- 9
- 3
- 6
+ 6/25...

result:

wrong answer wrong total time (test case 1)