一个问题
查看原帖
一个问题
377969
george0929楼主2023/5/24 18:26

RT,样例没过提交上去100pts,建议把样例数据增加到评测里面。

#include<bits/stdc++.h>
using namespace std;
int arr[105],cz[105];
int qwq[114][514]={
	{-1,-1,-1,-1,-1,-1},
{1,0,0,0,0,0,0},
{0,0,0,1,1,1,0},
{1,0,1,0,1,0,1},
{1,0,1,1,0,1,1},
{0,1,0,0,1,0,0},
{1,1,0,1,0,1,0},
{0,1,1,0,0,0,1},
{0,1,1,1,1,1,1}
};
int main(){
	int n,c;
	cin>>n>>c;
	if(c==0){
		int x;
		while(cin>>x){
			if(x==-1){
				break;
			}
		}
		while(cin>>x){
			if(x!=-1){
				cout<<"IMPOSSIBLE"<<endl;
				return 0;
			}
			if(x==-1){
				break;
			}
		}
		for(int i=1;i<=n;i++){
			cout<<1;
		}
		return 0;
	}else{
		bool Q=0;
		int x;
		while(cin>>x){
			arr[x]=1;
			if(x==-1){
				break;
			}
		}
		while(cin>>x){
			arr[x]=2;
			if(x==-1){
				break;
			}
		}
		for(int i=1;i<=8;i++){
			int f=1;
			for(int j=1;j<=n;j++){
				if(arr[j]==0){
					continue;
				}
				int pos=j%6;
				if(j%6==0){
					pos=6;
				}
				if((arr[j]==1&&qwq[i][pos]!=1)||(arr[j]==2&&qwq[i][pos]!=0)){
					f=0;
				}
			}
			if(f){
				Q=1;
//				cout<<i<<" ";
				for(int j=1;j<=n;j++){
					int pos=j%6;
					if(j%6==0){
						pos=6;
					}
					cout<<qwq[i][pos];
				}
				cout<<endl;
			}
		}
		if(!Q){
			cout<<"IMPOSSIBLE"<<endl;
		}
	}
}
2023/5/24 18:26
加载中...