Submission #434339


Source Code Expand

#include <iostream>
#include <algorithm>

using namespace std;

#define HAI 1
#define LOW 2

int ww[5][4];
int hh[4][5];

int bd[5][5];

int main(){
	for ( int w = 0; w < 5; w++ )
		for ( int h = 0; h < 5; h++ )
		{
			int x;
			cin >> x;
			bd[w][h] = x;
		}

	int mujun = 0;
	for ( int w = 0; w < 5; w++ )
		for ( int h = 0; h < 4; h++ ){
			if ( bd[w][h] != 0 && bd[w][h + 1] != 0 ){
				if ( bd[w][h] < bd[w][h + 1] )
					ww[w][h] = HAI;
				else
					ww[w][h] = LOW;//三項演算子を容易に実現する命令セット
				for ( int h2 = h - 1; 0 <= h2; h2-- )
				{
					if ( ww[w][h2] != ww[w][h2 + 1] )mujun++;
					ww[w][h2] = ( ww[w][h2 + 1] == HAI ) ? LOW : HAI;
				}
				for ( int h2 = h + 1; h2 < 4; h2++ )
				{
					if ( ww[w][h2] != ww[w][h2 - 1] )mujun++;
					ww[w][h2] = ( ww[w][h2 - 1] == HAI ) ? LOW : HAI;
				}
			}
		}
	for ( int w = 0; w < 4; w++ )
		for ( int h = 0; h < 5; h++ ){
			if ( bd[w][h] != 0 && bd[w + 1][h] != 0 ){
				if ( bd[w][h] < bd[w + 1][h] )
					hh[w][h] = HAI;
				else
					hh[w][h] = LOW;
				for ( int w2 = w - 1; 0 <= w2; w2-- )
				{
					if ( ww[w2][h] != ww[w2 + 1][h] )mujun++;
					ww[w2][h] = ( ww[w2 + 1][h] == HAI ) ? LOW : HAI;
				}
				for ( int w2 = w + 1; w2 < 4; w2++ )
				{
					if ( ww[w2][h] != ww[w2 + 1][h] )mujun++;
					ww[w2][h] = ( ww[w2 + 1][h] == HAI ) ? LOW : HAI;
				}
			}
		}
//minaide
}

Submission Info

Submission Time
Task D - 25個の整数
User toikage
Language C++14 (Clang++ 3.4)
Score 0
Code Size 1438 Byte
Status WA
Exec Time 30 ms
Memory 920 KB

Judge Result

Set Name Sample Subtask1 Subtask2
Score / Max Score 0 / 0 0 / 30 0 / 70
Status
WA × 4
WA × 19
WA × 29
Set Name Test Cases
Sample sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt
Subtask1 sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt, test-1-01.txt, test-1-02.txt, test-1-03.txt, test-1-04.txt, test-1-05.txt, test-1-06.txt, test-1-07.txt, test-1-08.txt, test-1-09.txt, test-1-10.txt, test-1-11.txt, test-1-12.txt, test-1-13.txt, test-1-14.txt, test-1-15.txt
Subtask2 sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt, test-1-01.txt, test-1-02.txt, test-1-03.txt, test-1-04.txt, test-1-05.txt, test-1-06.txt, test-1-07.txt, test-1-08.txt, test-1-09.txt, test-1-10.txt, test-1-11.txt, test-1-12.txt, test-1-13.txt, test-1-14.txt, test-1-15.txt, test-2-01.txt, test-2-02.txt, test-2-03.txt, test-2-04.txt, test-2-05.txt, test-2-06.txt, test-2-07.txt, test-2-08.txt, test-2-09.txt, test-2-10.txt
Case Name Status Exec Time Memory
sample-01.txt WA 22 ms 796 KB
sample-02.txt WA 22 ms 676 KB
sample-03.txt WA 25 ms 732 KB
sample-04.txt WA 23 ms 792 KB
test-1-01.txt WA 24 ms 916 KB
test-1-02.txt WA 24 ms 792 KB
test-1-03.txt WA 24 ms 920 KB
test-1-04.txt WA 23 ms 732 KB
test-1-05.txt WA 25 ms 728 KB
test-1-06.txt WA 24 ms 792 KB
test-1-07.txt WA 25 ms 792 KB
test-1-08.txt WA 25 ms 728 KB
test-1-09.txt WA 25 ms 792 KB
test-1-10.txt WA 26 ms 728 KB
test-1-11.txt WA 25 ms 732 KB
test-1-12.txt WA 23 ms 796 KB
test-1-13.txt WA 24 ms 792 KB
test-1-14.txt WA 23 ms 664 KB
test-1-15.txt WA 24 ms 668 KB
test-2-01.txt WA 24 ms 916 KB
test-2-02.txt WA 24 ms 920 KB
test-2-03.txt WA 30 ms 784 KB
test-2-04.txt WA 25 ms 736 KB
test-2-05.txt WA 22 ms 796 KB
test-2-06.txt WA 24 ms 792 KB
test-2-07.txt WA 24 ms 676 KB
test-2-08.txt WA 22 ms 792 KB
test-2-09.txt WA 24 ms 676 KB
test-2-10.txt WA 23 ms 808 KB