AtCoder Regular Contest 002

Submission #6881119

Source codeソースコード

//趣题
//评价
//劣质代码
//#pragma GCC optimize(3)
//#pragma G++ optimize(3)
#include <bits/stdc++.h>
using namespace std;
char board[2050][2050];
int n,m;
int x,o;
void doit(int i,int j,int cur)
{
	if(board[i][j]=='o')
	{
		if(cur==1)
		{
			if(board[i][j+1]=='.')
			{
				board[i][j+1]='o';
				board[i][j]='.';
			}
			return;
		}
		if(board[i][j+1]=='.')
		{
			board[i][j+1]='o';
			board[i][j]='.';
		}
		else if(board[i][j+1]=='x')
		{
			x--;
			board[i][j+1]='o';
			board[i][j]='.';
		}
	}
	else if(board[i][j]=='x')
	{
		if(cur==1)
		{
			if(board[i][j-1]=='.')
			{
				board[i][j-1]='x';
				board[i][j]='.';
			}
			return;
		}
		if(board[i][j-1]=='.')
		{
			board[i][j-1]='x';
			board[i][j]='.';
		}
		else if(board[i][j-1]=='o')
		{
			o--;
			board[i][j-1]='x';
			board[i][j]='.';
		}
	}
}
char win;
bool check()
{
	if(!x)
	{
		win='o';
		return true;
	}
	if(!o)
	{
		win='x';
		return true;
	}
	for(int i=0;i<n;i++)
	{
		if(board[0][i]=='x')
		{
			win='x';
			return true;
		}
		if(board[m-1][i]=='o')
		{
			win='x';
			return true;
		}
	}
	return false;
}
int main ()
{
	ios::sync_with_stdio(0);
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			cin>>board[i][j];
			if(board[i][j]=='o')
			{
				o++;
			}
			if(board[i][j]=='x')
			{
				x++;
			}
		}
	}
	int cur=1;
	while(!check())
	{
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<m;j++)
			{
				doit(i,j,cur);
			}
		}
		cur++;
	}
	cout<<win<<endl;
	return 0;
}
//终于写完了!!!
//祝:WA声一片
//评测结果...

Submission

Task問題 D - ボードゲーム
User nameユーザ名 shiweiling
Created time投稿日時
Language言語 C++ (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 1655 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
All 0 / 100 00_sample_00.txt,00_sample_01.txt,00_sample_min.txt,00_sample_min2.txt,01_rndmini_00.txt,01_rndmini_01.txt,01_rndmini_02.txt,01_rndmini_03.txt,01_rndmini_04.txt,02_rnd_00.txt,02_rnd_01.txt,02_rnd_02.txt,02_rnd_03.txt,02_rnd_04.txt,02_rnd_05.txt,02_rnd_06.txt,02_rnd_07.txt,02_rnd_08.txt,02_rnd_09.txt,02_rnd_10.txt,02_rnd_11.txt,02_rnd_12.txt,02_rnd_13.txt,02_rnd_14.txt,02_rnd_15.txt,02_rnd_16.txt,02_rnd_17.txt,02_rnd_18.txt,02_rnd_19.txt,02_rnd_20.txt,03_1free_00.txt,03_1free_01.txt,03_1free_02.txt,04_manyfree_00.txt,04_manyfree_01.txt,04_manyfree_02.txt,05_maxmove_00.txt,05_maxmove_01.txt,06_rndhard_0_0.txt,06_rndhard_0_1.txt,06_rndhard_10_0.txt,06_rndhard_10_1.txt,06_rndhard_11_0.txt,06_rndhard_11_1.txt,06_rndhard_12_0.txt,06_rndhard_12_1.txt,06_rndhard_13_0.txt,06_rndhard_13_1.txt,06_rndhard_14_0.txt,06_rndhard_14_1.txt,06_rndhard_15_0.txt,06_rndhard_15_1.txt,06_rndhard_16_0.txt,06_rndhard_16_1.txt,06_rndhard_17_0.txt,06_rndhard_17_1.txt,06_rndhard_18_0.txt,06_rndhard_18_1.txt,06_rndhard_19_0.txt,06_rndhard_19_1.txt,06_rndhard_1_0.txt,06_rndhard_1_1.txt,06_rndhard_20_0.txt,06_rndhard_20_1.txt,06_rndhard_2_0.txt,06_rndhard_2_1.txt,06_rndhard_3_0.txt,06_rndhard_3_1.txt,06_rndhard_4_0.txt,06_rndhard_4_1.txt,06_rndhard_5_0.txt,06_rndhard_5_1.txt,06_rndhard_6_0.txt,06_rndhard_6_1.txt,06_rndhard_7_0.txt,06_rndhard_7_1.txt,06_rndhard_8_0.txt,06_rndhard_8_1.txt,06_rndhard_9_0.txt,06_rndhard_9_1.txt,07_maxnum_00.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample_00.txt AC 1 ms 256 KB
00_sample_01.txt AC 1 ms 256 KB
00_sample_min.txt WA
00_sample_min2.txt AC 1 ms 256 KB
01_rndmini_00.txt AC 1 ms 256 KB
01_rndmini_01.txt WA
01_rndmini_02.txt AC 1 ms 256 KB
01_rndmini_03.txt AC 1 ms 256 KB
01_rndmini_04.txt AC 1 ms 256 KB
02_rnd_00.txt WA
02_rnd_01.txt AC 81 ms 4352 KB
02_rnd_02.txt WA
02_rnd_03.txt AC 87 ms 4352 KB
02_rnd_04.txt WA
02_rnd_05.txt AC 88 ms 4352 KB
02_rnd_06.txt AC 90 ms 4352 KB
02_rnd_07.txt WA
02_rnd_08.txt AC 88 ms 4352 KB
02_rnd_09.txt WA
02_rnd_10.txt AC 89 ms 4352 KB
02_rnd_11.txt AC 88 ms 4352 KB
02_rnd_12.txt AC 89 ms 4352 KB
02_rnd_13.txt AC 89 ms 4352 KB
02_rnd_14.txt WA
02_rnd_15.txt AC 89 ms 4352 KB
02_rnd_16.txt WA
02_rnd_17.txt AC 88 ms 4352 KB
02_rnd_18.txt AC 88 ms 4352 KB
02_rnd_19.txt WA
02_rnd_20.txt WA
03_1free_00.txt AC 74 ms 4352 KB
03_1free_01.txt WA
03_1free_02.txt AC 88 ms 4352 KB
04_manyfree_00.txt TLE
04_manyfree_01.txt WA
04_manyfree_02.txt TLE
05_maxmove_00.txt AC 57 ms 4352 KB
05_maxmove_01.txt WA
06_rndhard_0_0.txt AC 74 ms 4352 KB
06_rndhard_0_1.txt WA
06_rndhard_10_0.txt AC 88 ms 4352 KB
06_rndhard_10_1.txt WA
06_rndhard_11_0.txt AC 88 ms 4352 KB
06_rndhard_11_1.txt WA
06_rndhard_12_0.txt AC 88 ms 4352 KB
06_rndhard_12_1.txt WA
06_rndhard_13_0.txt AC 88 ms 4352 KB
06_rndhard_13_1.txt WA
06_rndhard_14_0.txt AC 88 ms 4352 KB
06_rndhard_14_1.txt WA
06_rndhard_15_0.txt AC 88 ms 4352 KB
06_rndhard_15_1.txt WA
06_rndhard_16_0.txt AC 88 ms 4352 KB
06_rndhard_16_1.txt WA
06_rndhard_17_0.txt AC 87 ms 4352 KB
06_rndhard_17_1.txt WA
06_rndhard_18_0.txt AC 88 ms 4352 KB
06_rndhard_18_1.txt WA
06_rndhard_19_0.txt AC 88 ms 4352 KB
06_rndhard_19_1.txt WA
06_rndhard_1_0.txt AC 82 ms 4352 KB
06_rndhard_1_1.txt WA
06_rndhard_20_0.txt AC 88 ms 4352 KB
06_rndhard_20_1.txt WA
06_rndhard_2_0.txt AC 86 ms 4352 KB
06_rndhard_2_1.txt WA
06_rndhard_3_0.txt AC 87 ms 4352 KB
06_rndhard_3_1.txt WA
06_rndhard_4_0.txt AC 88 ms 4352 KB
06_rndhard_4_1.txt WA
06_rndhard_5_0.txt AC 89 ms 4352 KB
06_rndhard_5_1.txt WA
06_rndhard_6_0.txt AC 88 ms 4352 KB
06_rndhard_6_1.txt WA
06_rndhard_7_0.txt AC 88 ms 4352 KB
06_rndhard_7_1.txt WA
06_rndhard_8_0.txt AC 88 ms 4352 KB
06_rndhard_8_1.txt WA
06_rndhard_9_0.txt AC 88 ms 4352 KB
06_rndhard_9_1.txt WA
07_maxnum_00.txt AC 60 ms 4352 KB