提出 #47230638


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,m,a[N],b[N],fa[N<<1];
int find(int x)
{
	return x==fa[x]?x:fa[x]=find(fa[x]);
}
signed main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n<<1;i++)fa[i]=i;
	for(int i=1;i<=m;i++)scanf("%d",a+i);
	for(int i=1;i<=m;i++)scanf("%d",b+i);
	for(int i=1;i<=m;i++)
	{
		if(find(a[i])==find(b[i]))
		{
			printf("No");
			return 0;
		}
		fa[find(a[i])]=find(b[i]+n),fa[find(b[i])]=find(a[i]+n);
	}
	printf("Yes");
	return 0;
}

提出情報

提出日時
問題 D - Good Tuple Problem
ユーザ lishujia
言語 C++ 20 (gcc 12.2)
得点 400
コード長 510 Byte
結果 AC
実行時間 42 ms
メモリ 6876 KiB

コンパイルエラー

Main.cpp: In function ‘int main()’:
Main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d%d",&n,&m);
      |         ~~~~~^~~~~~~~~~~~~~
Main.cpp:13:35: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         for(int i=1;i<=m;i++)scanf("%d",a+i);
      |                              ~~~~~^~~~~~~~~~
Main.cpp:14:35: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         for(int i=1;i<=m;i++)scanf("%d",b+i);
      |                              ~~~~~^~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 4
AC × 27
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_1_00.txt, 01_random_1_01.txt, 01_random_1_02.txt, 01_random_1_03.txt, 01_random_1_04.txt, 02_random_2_00.txt, 02_random_2_01.txt, 02_random_2_02.txt, 02_random_2_03.txt, 02_random_2_04.txt, 02_random_2_05.txt, 02_random_2_06.txt, 02_random_2_07.txt, 02_random_2_08.txt, 02_random_2_09.txt, 03_tree_00.txt, 04_path_00.txt, 05_corner_00.txt, 05_corner_01.txt, 05_corner_02.txt, 05_corner_03.txt, 05_corner_04.txt, 05_corner_05.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3696 KiB
00_sample_01.txt AC 1 ms 3580 KiB
00_sample_02.txt AC 1 ms 3688 KiB
00_sample_03.txt AC 1 ms 3828 KiB
01_random_1_00.txt AC 5 ms 4320 KiB
01_random_1_01.txt AC 3 ms 4752 KiB
01_random_1_02.txt AC 5 ms 4572 KiB
01_random_1_03.txt AC 5 ms 5240 KiB
01_random_1_04.txt AC 15 ms 4712 KiB
02_random_2_00.txt AC 14 ms 4560 KiB
02_random_2_01.txt AC 18 ms 5136 KiB
02_random_2_02.txt AC 13 ms 4456 KiB
02_random_2_03.txt AC 16 ms 4516 KiB
02_random_2_04.txt AC 15 ms 4472 KiB
02_random_2_05.txt AC 12 ms 4772 KiB
02_random_2_06.txt AC 18 ms 5160 KiB
02_random_2_07.txt AC 22 ms 5220 KiB
02_random_2_08.txt AC 18 ms 4888 KiB
02_random_2_09.txt AC 22 ms 5148 KiB
03_tree_00.txt AC 42 ms 6808 KiB
04_path_00.txt AC 27 ms 6808 KiB
05_corner_00.txt AC 1 ms 3764 KiB
05_corner_01.txt AC 18 ms 5256 KiB
05_corner_02.txt AC 19 ms 5380 KiB
05_corner_03.txt AC 20 ms 5440 KiB
05_corner_04.txt AC 26 ms 6700 KiB
05_corner_05.txt AC 36 ms 6876 KiB