QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#611223#5140. Frozen ScoreboardzakeCompile Error//C++172.8kb2024-10-04 19:58:202024-10-04 19:58:22

Judging History

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

  • [2024-10-04 19:58:22]
  • 评测
  • [2024-10-04 19:58:20]
  • 提交

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].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

answer.code: In function ‘int main()’:
answer.code:54:48: error: request for member ‘b’ in ‘tmp.node1::sub’, which is of non-class type ‘int’
   54 |                                 b[i].x=tmp.sub.b[i].time=tmp.x;
      |                                                ^