結果

問題 No.1366 交換門松列・梅
ユーザー GafoGafoGafoGafo
提出日時 2021-02-23 23:51:07
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 2,022 bytes
コンパイル時間 238 ms
コンパイル使用メモリ 30,080 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 10:34:24
合計ジャッジ時間 822 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#define NUM 3

int main()
{
	int box1[NUM];
	int box2[NUM];
	int tem = 0;

	int i, j, k=1;

	for(i = 0; i < NUM; i++)
	{
		scanf("%d", &box1[i]);
	}

	for(i = 0; i < NUM; i++)
	{
		scanf("%d", &box2[i]);
	}

	if((box1[0] == box1[1])&&(box1[0] == box1[2])&&(box1[1] == box1[2]))
	{
		printf("No\n");
		return 0;
	}
	else if((box2[0] == box2[1])&&(box2[0] == box2[2])&&(box2[1] == box2[2]))
	{
		printf("No\n");
		return 0;
	}
	else
	{
		for(i = 0; i < NUM; i++)
		{
			for(j = 0; j < NUM; j++)
			{
				//printf("tem:%d box1[i]:%d box2[j]:%d   i:%dj:%d\n", tem, box1[i], box2[j], i, j);
				tem = box1[i];
				box1[i] = box2[j];
				box2[j] = tem;

				//printf("tem:%d box1[i]:%d box2[j]:%d   i:%dj:%d\n", tem, box1[i], box2[j], i, j);
				//printf("%d %d %d\n", box1[0],box1[1],box1[2]);
				//printf("%d %d %d\n", box2[0],box2[1],box2[2]);
				
				if((box1[0]!=box1[1])&&(box1[0]!=box1[2])&&(box1[1]!=box1[2])&&(box2[0]!=box2[1])&&(box2[0]!=box2[2])&&(box2[1]!=box2[2])){
				if((box1[1] > box1[0]) && (box1[1] > box1[2]) && (box2[1] > box2[0]) && (box2[1] > box2[2]))
				{
					printf("Yes\n");
					return 0;
				}
				else if((box1[1] > box1[0]) && (box1[1] > box1[2]) && (box2[1] < box2[0])&&(box2[1] < box2[2]))
				{
					printf("Yes\n");
					return 0;
				}
				else if((box1[1] < box1[0]) && (box1[1] < box1[2]) && (box2[1] > box2[0]) && (box2[1] > box2[2]))
				{
					printf("Yes\n");
					return 0;
				}
				else if((box1[1] < box1[0])&&(box1[1] < box1[2]) && (box2[1] < box2[0]) && (box2[1] < box2[2]))
				{
					printf("Yes\n");
					return 0;
				}
				}
				//printf("tem:%d box1[i]:%d box2[j]:%d   i:%dj;%d\n", tem, box1[i], box2[j], i, j);
				tem = box1[i];
				box1[i] = box2[j];
				box2[j] = tem;
				//printf("tem:%d box1[i]:%d box2[j]:%d   i:%dj:%d\n", tem, box1[i], box2[j], i, j);
				
				//printf("%d %d %d\n", box1[0],box1[1],box1[2]);
				//printf("%d %d %d\n", box2[0],box2[1],box2[2]);

				//printf("%d\n", k);
				//k++;
			}
		}
	}

	printf("No\n");
	return 0;
}
0