QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#693642#5140. Frozen Scoreboardlir_nutWA 4ms3860kbC++143.2kb2024-10-31 16:30:522024-10-31 16:30:53

Judging History

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

  • [2024-10-31 16:30:53]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3860kb
  • [2024-10-31 16:30:52]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
struct node{
	int po;
	int op;
	int pen=0;
	int fro=0;
	int anssub=0;
	int anspe=0;
}a[100];
bool cmp(node x,node y){
	return x.op>y.op;
}
bool cp(node x,node y){
	return x.po<y.po;
}
int n,t;
void prin(){
	printf("Yes\n");
	sort(a+1,a+1+t,cp);
	for(int i=1;i<=t;i++){
		if(a[i].op==-10){
			printf(".\n");
		}else if(a[i].op==-1){
			printf("- %d\n",a[i].pen/20);
		}else if(a[i].op==100){
			printf("- %d\n",a[i].pen/20+a[i].fro);
		}else if(a[i].op==1){
			printf("+ %d/%d\n",a[i].anssub,a[i].anspe);
		}
	}
}
int sel[100];
int A[100];
bool check(int k,int sum,int final){
	for(int i=1;i<=k;i++){
		sum+=240;
		sum+=a[sel[i]].pen;//固有罚时
		a[sel[i]].anspe=240;
		a[sel[i]].anssub=a[sel[i]].pen/20+1;//最后一发通过
	}
	if(sum>final){
		return 0;
	}
	for(int i=1;i<=k;i++){
		if(sum+(a[sel[i]].fro-1)*20+59<final){
			a[sel[i]].anssub+=(a[sel[i]].fro-1);
			a[sel[i]].anspe=299;
			sum+=(a[sel[i]].fro-1)*20+59;
		}else{
			int ok=final-sum;
			int ss=min(ok/20,a[sel[i]].fro-1);
			assert(a[sel[i]].fro>0);
            // int ss=ok/20;
            a[sel[i]].anssub+=ss;
			a[sel[i]].anspe+=(ok-ss*20);
			sum=final;
		}
	}
	return (sum==final);
}
void dfs(int cur,int k,int& jd,int num,int sum,int final){
	if(jd==1){
		return;
	}
	if(cur==k+1){
		jd=check(k,sum,final);
		if(jd==1){
			for(int x=1;x<=k;x++){
				a[sel[x]].op=1;
			}
			prin();
			return ;
		}
	}else{
		for(int i=1;i<=num&&jd==0;i++){
			if(jd==0&&(cur==1||sel[cur-1]<i)&&A[i]==0){
				sel[cur]=i;
				A[i]=1;
				dfs(cur+1,k,jd,num,sum,final);
				A[i]=0;
			}else continue;
		}
	}
}
void solve(){
	int finalac,finalpe;
	scanf("%d %d",&finalac,&finalpe);
	int cnt=0;//ac数
	int cnt1=0;//问号
	int sum=0;//penalty
	for(int i=1;i<=t;i++){
		char ch;string s;
		cin>>ch;
		a[i].fro=0;a[i].pen=0;a[i].po=i;a[i].anspe=0;a[i].anssub=0;//init
		if(ch=='+'){
			cnt++;
			a[i].op=1;		
		}else if(ch=='-'){
			a[i].op=-1;
		}else if(ch=='?'){//?
			a[i].op=100;
			cnt1++;
		}else{
			a[i].op=-10;
		}
		int sub=0;
		int pen=0;
		if(ch=='+'){
			cin>>s;
			int chan=1;
			for(int ix=0;ix<s.length();ix++){
				if(s[ix]=='/'){
					a[i].pen=(sub-1)*20;	
					chan=0;
				}
				if(chan){
					sub+=(int)(s[ix]-48);
				}
				if(!chan&&s[ix]!='/'){
					pen=pen*10+(int)(s[ix]-48);
				}
			}
			a[i].anspe=pen;
			a[i].pen+=pen;
			a[i].fro=0;
			sum+=a[i].pen;
			a[i].anssub=sub;
		}else if(ch=='?'){
			int x,y;
			scanf("%d %d",&x,&y);
			a[i].pen=(y-x)*20;
			a[i].fro=x;
		}else if(ch=='-'){
			int x;scanf("%d",&x);
			a[i].pen=x*20;//没过
		}
	}
	int need=finalac-cnt;//还要ac几题
	if(need<0||need>cnt1){//ac多了||问号不够
		printf("No\n");
		return;
	}
	sort(a+1,a+1+t,cmp);
	int jd=0;
	for(int i=0;i<100;i++) {A[i]=0;sel[i]=0;}
	dfs(1,need,jd,cnt1,sum,finalpe);//cnt1=?
	if(jd==0){
		printf("No\n");
	}
}
int main(){
	scanf("%d %d",&n,&t);
	for(int j=1;j<=n;j++){
		solve();
	}
    return 0;
}
/*
2 6
4 806
+ 1/6
? 3 4
+ 4/183
- 2
+ 3/217
.

4 1078
? 7 9
? 1 1
? 2 2
+ 2/60
- 10
? 4 10

1 2
1 300
? 1 2
? 1 1
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 3804kb

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: 4ms
memory: 3860kb

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/240
- 5
+ 1/240
- 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 ans finds the answer, but out doesn't (test case 12)