QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#611162#5140. Frozen ScoreboardzakeWA 2ms3828kbC++172.3kb2024-10-04 19:42:232024-10-04 19:42:24

Judging History

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

  • [2024-10-04 19:42:24]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3828kb
  • [2024-10-04 19:42:23]
  • 提交

answer

#include <bits/stdc++.h>
#define pb push_back
using namespace std;
struct node{
	char op;
	int x,time,id;
};
struct node1{
	int sub,x,id;
};

int number_of_1(int m)
{
	int count = 0;
	int i = 0;
	for (i = 0; i < 32; i++)
	{
		if (((m >> i) & 1) == 1)
			count++;
	}
	return count;
}

const int N=2e5+5;
node a[N];

signed main(){
	ios::sync_with_stdio(0); cin.tie(0);
	int n,m;
	cin>>n>>m;
	while(n--){
	    int flag1=0;
		int x,time;
		cin>>x>>time;
		int nowt=0,nowx=0;
		vector<node1> res;
		for(int i=1;i<=m;i++){
			cin>>a[i].op;
			a[i].id=i;
			if(a[i].op=='+'){
			    char c;
			    cin>>a[i].x>>c>>a[i].time;
			    nowt+=a[i].time+(a[i].x-1)*20;
				nowx++;
			}
			else if(a[i].op=='?'){
				node1 tmp;
				tmp.id=i;
				cin>>tmp.sub>>tmp.x;
				res.pb(tmp);
			}
			else if(a[i].op=='-'){
				cin>>a[i].x;
			}
		}
		
		int tt=time-nowt;
		int cnt1=x-nowx;
		int S=res.size();
		for(int i=0;i<(1<<S);i++){
			if(number_of_1(i)!=cnt1){
				continue;
			}
			for(int j=0;j<S;j++){
				if((i>>j)&1){
					tt-=(240+(res[j].x-res[j].sub)*20);
				}
			}
			if(tt<0){
				continue;
			}
			
			for(int j=0;j<S;j++){
				if((i>>j)&1){
					tt-=min(res[j].sub-1,tt/20)*20;
				}
			}
			
			for(int j=0;j<S;j++){
				if((i>>j)&1){
					tt-=min(tt,59);
				}
			}
			
			
			if(tt==0){
				tt=time-nowt;
				for(int j=0;j<S;j++){
					if((i>>j)&1){
						a[res[j].id].op='+';
						tt-=(240+(res[j].x-res[j].sub)*20);
					}else{
						a[res[j].id].op='-';
						a[res[j].id].x=res[j].x;
					}
				}
				
				for(int j=0;j<S;j++){
					if((i>>j)&1){
						int tmp=min(res[j].sub-1,tt/20);
						tt-=tmp*20;
						a[res[j].id].x=res[j].x-res[j].sub+tmp+1;
						a[res[j].id].time=240;
					}
				}
				for(int j=0;j<S;j++){
					if((i>>j)&1){
						a[res[j].id].time+=min(tt,59);
						tt-=min(tt,59);
					}
				}
				
				cout<<"Yes\n";
				for(int i=1;i<=m;i++){
					if(a[i].op=='+'){
						cout<<"+ "<<a[i].x<<"/"<<a[i].time<<'\n';
					}else if(a[i].op=='-'){
						cout<<"- "<<a[i].x<<'\n';
					}else{
						cout<<"."<<'\n';
					}
				}
				
				flag1=1;
				break;
			}
		}
		if(flag1==0)
		    cout<<"No\n";
		
	}
	return 0;
}
/*
1 13
6 1519
+ 3/183
- 1
+ 9/133
? 2 3
- 5
? 1 3
- 5
? 1 1
? 1 3
- 5
+ 1/165
- 6
? 2 5
 */

詳細信息

Test #1:

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

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

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

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
.
.
.
.
.
.
.
.
.
.
.
.
.
No
Yes
.
- 1
+ 1/285
- 1
+ 1/60
.
.
- 1
.
.
.
.
...

result:

wrong answer ans finds the answer, but out doesn't (test case 6)