QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#102023#4365. Clock Breakingfzj2007WA 2ms3352kbC++144.3kb2023-05-02 10:23:292023-05-02 10:23:33

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-02 10:23:33]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3352kb
  • [2023-05-02 10:23:29]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
namespace IO{
	template<typename T>inline bool read(T &x){
		x=0;
		char ch=getchar();
		bool flag=0,ret=0;
		while(ch<'0'||ch>'9') flag=flag||(ch=='-'),ch=getchar();
		while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar(),ret=1;
		x=flag?-x:x;
        return ret;
	}
	template<typename T,typename ...Args>inline bool read(T& a,Args& ...args){
	    return read(a)&&read(args...);
	}
	template<typename T>void prt(T x){
		if(x>9) prt(x/10);
		putchar(x%10+'0');
	}
	template<typename T>inline void put(T x){
		if(x<0) putchar('-'),x=-x;
		prt(x);
	}
	template<typename T>inline void put(char ch,T x){
		if(x<0) putchar('-'),x=-x;
		prt(x);
		putchar(ch);
	}
	template<typename T,typename ...Args>inline void put(T a,Args ...args){
	    put(a);
		put(args...);
	}
	template<typename T,typename ...Args>inline void put(const char ch,T a,Args ...args){
	    put(ch,a);
		put(ch,args...);
	}
	inline void put(string s){
		for(int i=0,sz=s.length();i<sz;i++) putchar(s[i]);
	}
	inline void put(const char* s){
		for(int i=0,sz=strlen(s);i<sz;i++) putchar(s[i]);
	}
	inline int getch(){
		char ch=getchar();
		while(ch!='X'&&ch!='.') ch=getchar();
		return ch=='X';
	}
}
using namespace IO;
const int num[10][7][4]=
{
	{
	{0,1,1,0},
	{1,0,0,1},
	{1,0,0,1},
	{0,0,0,0},
	{1,0,0,1},
	{1,0,0,1},
	{0,1,1,0},
	},
	{
	{0,0,0,0},
	{0,0,0,1},
	{0,0,0,1},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1,1,0,0,0,1,1,0},	
};
/*
每个位置要么是对的,要么是一直亮,要么是一直暗 
*/ 
int n,mp[105][7][21],ans[7][21],now[7][21],vis0[7][21],vis1[7][21],to[7][21];
inline void prework(int y,int op){
	for(int i=0;i<7;i++)
		for(int j=0;j<4;j++)
			to[i][j+y]=num[op][i][j];
}
inline void solve(int x,int y){
	for(int i=0;i<7;i++)
		for(int j=0;j<21;j++) now[i][j]=1;
	for(int k=1;k<=n;k++){
		prework(0,x/10);
		prework(5,x%10);
		prework(12,y/10);
		prework(17,y%10);
		to[2][10]=to[4][10]=1;
		for(int i=0;i<7;i++)
			for(int j=0;j<21;j++){
				if(!st[i][j]) continue;
				now[i][j]&=mp[k][i][j]==to[i][j];
				if(!now[i][j]&&!vis0[i][j]&&!vis1[i][j]) return;
			}
		if(++y==60){
			y=0;
			if(++x==24) x=0;
		}
	}
	for(int i=0;i<7;i++)
		for(int j=0;j<21;j++){
			if(!st[i][j]) ans[i][j]=0;
			else{
				int num=now[i][j]+vis0[i][j]+vis1[i][j];
				if(num>=2) ans[i][j]=4;
				else{
					int sta=0;
					if(now[i][j]) sta=1;
					else if(vis0[i][j]) sta=2;
					else sta=3;
					if(ans[i][j]==-1||ans[i][j]==sta) ans[i][j]=sta;
					else ans[i][j]=4;
				}
			}
		}
}
int main(){
	read(n);
	for(int i=0;i<7;i++)
		for(int j=0;j<21;j++) vis0[i][j]=vis1[i][j]=1;
	for(int k=1;k<=n;k++)
		for(int i=0;i<7;i++)
			for(int j=0;j<21;j++) mp[k][i][j]=getch(),vis0[i][j]&=!mp[k][i][j],vis1[i][j]&=mp[k][i][j];
	memset(ans,-1,sizeof(ans));
	for(int x=0;x<24;x++)
		for(int y=0;y<60;y++) solve(x,y);
	if(ans[0][0]==-1) return puts("impossible"),0;
	for(int i=0;i<7;i++){
		for(int j=0;j<21;j++){
			if(ans[i][j]==0) putchar('.');
			else if(ans[i][j]==1) putchar('W');
			else if(ans[i][j]==2) putchar('0');
			else if(ans[i][j]==3) putchar('1');
			else putchar('?');
		}
		putchar('\n');
	}
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3352kb

input:

3
......XX.....XX...XX.
.....X..X...X..X....X
.....X..X.X.X..X....X
.............XX...XX.
.....X..X......X.X..X
.....X..X......X.X..X
......XX.....XX...XX.

......XX.....XX...XX.
.....X..X...X..X....X
.....X..X.X.X..X....X
.............XX...XX.
.....X..X......X.X..X
.....X..X......X.X..X
......XX......

output:

.??...WW.....??...??.
?..0.W..?...?..1.0..?
?..0.W..?.?.?..1.0..?
.??...??.....11...WW.
?..?.W..?.0.W..?.1..?
?..?.W..?...W..?.1..?
.??...11.....??...??.

result:

wrong answer 2nd lines differ - expected: '?..?.W..?...?..1.0..?', found: '?..0.W..?...?..1.0..?'