QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#229372#5140. Frozen Scoreboardwhsyhyyh#WA 1ms3696kbC++142.2kb2023-10-28 16:00:332023-10-28 16:00:33

Judging History

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

  • [2023-10-28 16:00:33]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3696kb
  • [2023-10-28 16:00:33]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,m;
int x,y;
char s[100];
struct info {
	int op;
	int x,y;
}Ans[1005];
struct node {
	int idx;
	int x,y;
}HAVE[1005];
int cnt;
int Low[1<<13];
bool Check(int now) {
	int yyy=y;
	int tmp=0,sg=0;
	int l=0,r=59*x;
	for(int i=0; i<cnt; ++i)
		if(now&(1<<i)) {
			yyy-=(HAVE[i+1].y-HAVE[i+1].x)*20+240;
			sg+=HAVE[i+1].x-1;
		}
	if(yyy<0)return false;
	if(yyy<=r)return true;
	int p=(yyy-r-1)/20+1;
	if(p<=sg)return true;
	return false;
}
void Solve(int now,int p,int yyy) {
	for(int i=0; i<cnt; ++i)
		if(now&(1<<i)) {
			Ans[HAVE[i+1].idx].op=0;
			if(HAVE[i+1].x-1>=p)Ans[HAVE[i+1].idx].x=HAVE[i+1].y-HAVE[i+1].x+p+1,p=0;
			else Ans[HAVE[i+1].idx].x=HAVE[i+1].y,p-=HAVE[i+1].x-1;
			if(yyy>59)Ans[HAVE[i+1].idx].y=299,yyy-=59;
			else Ans[HAVE[i+1].idx].y=240+yyy,yyy=0;
		}
}
int main() {
	scanf("%d%d",&n,&m);
	for(int i=0; i<(1<<13); ++i)Low[i]=Low[i>>1]+(i&1);
	while(n--) {
		scanf("%d%d",&x,&y);cnt=0;
		for(int i=1; i<=m; ++i) {
			scanf("%s",s);
			int tmpx,tmpy;
			if(s[0]=='+') {
				scanf("%d/%d",&tmpx,&tmpy);
				x--;y-=tmpy+(tmpx-1)*20;
				Ans[i]=(info)<%0,tmpx,tmpy%>;
			}
			if(s[0]=='-') {
				scanf("%d",&tmpx);
				Ans[i]=(info)<%1,tmpx,0%>;
			}
			if(s[0]=='?') {
				scanf("%d%d",&tmpx,&tmpy);
				Ans[i]=(info)<%2,tmpx,tmpy%>;
				HAVE[++cnt]=(node)<%i,tmpx,tmpy%>;
			}
			if(s[0]=='.')Ans[i]=(info)<%3,0,0%>;
		}
		if(x<0||y<0||x>cnt) {puts("No");continue;}
		bool mk=false;
		for(int i=0; i<(1<<cnt); ++i) {
			if(Low[i]!=x)continue;
			if(Check(i)) {
				int yyy=y;
				int tmp=0;
				int l=0,r=59*x;
				for(int j=0; j<cnt; ++j)
					if(i&(1<<j))
						yyy-=(HAVE[i+1].y-HAVE[i+1].x)*20+240;
				if(yyy<=r) {
					mk=true; 
					Solve(i,0,yyy);
					break;
				}
				int p=(yyy-r-1)/20+1;
				Solve(i,p,yyy-p*20);
				mk=true;
				break;	
			}
		}
		if(!mk)puts("No");
		else {
			puts("Yes");
			for(int i=1; i<=m; ++i) {
				if(Ans[i].op==0)printf("+ %d/%d\n",Ans[i].x,Ans[i].y);				
				if(Ans[i].op==1)printf("- %d\n",Ans[i].x);
				if(Ans[i].op==2)printf("- %d\n",Ans[i].y);
				if(Ans[i].op==3)printf(".\n");
			}
		}
	}
	return 0;
}	

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

wrong answer wrong total time (test case 1)