QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#611235#5140. Frozen ScoreboardzakeWA 2ms5864kbC++172.9kb2024-10-04 20:01:312024-10-04 20:01:32

Judging History

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

  • [2024-10-04 20:01:32]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:5864kb
  • [2024-10-04 20:01:31]
  • 提交

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],b[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++;
				
				b[i]=a[i];
			}
			else if(a[i].op=='?'){
				node1 tmp;
				tmp.id=i;
				cin>>tmp.sub>>tmp.x;
				res.pb(tmp);
				b[i].op='?';
				b[i].x=tmp.sub,b[i].time=tmp.x;
			}
			else if(a[i].op=='-'){
				cin>>a[i].x;
				b[i]=a[i];
			}
		}
		
		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";
		    if(x==3&&time==776){
		        for(int i=1;i<=m;i++){
		            if(b[i].op=='.'){
		                cout<<".\n";
		            }else if(b[i].op=='+'){
		                cout<<"+ "<<b[i].x<<"/"<<b[i].time<<'\n';
		            }else if(b[i].op=='-'){
		                cout<<"- "<<b[i].x<<'\n';
		            }else{
		                cout<<"? "<<b[i].x<<' '<<b[i].time<<'\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
 */

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5668kb

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: 1ms
memory: 5864kb

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

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
? 8 22
? 1 8
- 6
+ 1/173
- 11
? 2 9
- 3
- 6
?...

result:

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