AtCoder Typical Contest 001

Submission #11226932

Source codeソースコード

#include<bits/stdc++.h>
#define inf ((1<<30)-1)
#define linf ((1<<62)ll-1)
#define LL long long
#define F(i,a,b,c) for(register int i=(a);(b);i=(c))
#define Fu(i,a,b) for(register int i=(a);i<=(b);++i)
#define Fd(i,a,b) for(register int i=(a);i>=(b);--i)
#define Fn(i,a) for(register int i=las[(a)];i;i=nex[i])
#define COND(c) (isprint(c))
int Fl,Pn,SI=100;char mch=' ',ch,Bf[21];
void chin(char&c){while(!COND(c=getchar()));}
template<typename t>void in(t&a){a=0;ch=getchar();Fl=1;while(((ch<'0')||(ch>'9'))&&ch!=EOF)Fl=(ch=='-')?-Fl:Fl,ch=getchar();while((ch>='0')&&(ch<='9'))a=a*10+ch-'0',ch=getchar();a*=Fl;}template<typename t>void out(t a){if(a<0)putchar('-'),a=-a;if(a==0)putchar('0');while(a)Bf[++Pn]=a%10+'0',a/=10;while(Pn)putchar(Bf[Pn]),--Pn;putchar(mch);}
template<typename t,typename ...ARGS>void in(t&a,ARGS&...args){in(a);in(args...);}
template<typename t,typename ...ARGS>void out(t a,ARGS... args){out(a);out(args...);}
using namespace std;
int n,m,f[(int)1e5+1],t1,t2,t3;
int getf(int x)
{
	if(f[x]==x)return x;
	return f[x]=getf(f[x]);
}
int main()
{
	in(n,m);
	Fu(i,1,n)f[i]=i;
	Fu(i,1,m)
	{
		in(t1,t2,t3);
		if(t1==0)f[getf(t3)]=getf(t2);
		else puts((getf(t2)==getf(t3))?"Yes":"No");
	}
	return 0;
}
//BY Segment_Tree_Juruo (2020严誉沣)

Submission

Task問題 B - Union Find
User nameユーザ名 luogu_bot2
Created time投稿日時
Language言語 C++ (GCC 5.4.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 1298 Byte
File nameファイル名
Exec time実行時間 31 ms
Memory usageメモリ使用量 1280 KB

Compiler messageコンパイルメッセージ

./Main.cpp:13:30: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<typename t,typename ...ARGS>void in(t&a,ARGS&...args){in(a);in(args...);}
^
./Main.cpp:13:58: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<typename t,typename ...ARGS>void in(t&a,ARGS&...args){in(a);in(args...);}
^
./Main.cpp:14:30: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<typename t,typename ...ARGS>void out(t a,ARGS... args){out(a);out(args...);}
^
./Main.cpp:14:59: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<typename t,typename ...ARGS>void out(t a,ARGS... args){out(a);out(args...);}
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - 00_sample_01.txt
All 100 / 100 00_sample_01.txt,subtask_01_01.txt,subtask_01_02.txt,subtask_01_03.txt,subtask_01_04.txt,subtask_01_05.txt,subtask_01_06.txt,subtask_01_07.txt,subtask_01_08.txt,subtask_01_09.txt,subtask_01_10.txt,subtask_01_11.txt,subtask_01_12.txt,subtask_01_13.txt,subtask_01_14.txt,subtask_01_15.txt,subtask_01_16.txt,subtask_01_17.txt,subtask_01_18.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample_01.txt AC 1 ms 256 KB
subtask_01_01.txt AC 15 ms 640 KB
subtask_01_02.txt AC 1 ms 640 KB
subtask_01_03.txt AC 15 ms 1024 KB
subtask_01_04.txt AC 28 ms 1152 KB
subtask_01_05.txt AC 2 ms 256 KB
subtask_01_06.txt AC 3 ms 640 KB
subtask_01_07.txt AC 21 ms 896 KB
subtask_01_08.txt AC 28 ms 1280 KB
subtask_01_09.txt AC 1 ms 256 KB
subtask_01_10.txt AC 1 ms 640 KB
subtask_01_11.txt AC 16 ms 896 KB
subtask_01_12.txt AC 28 ms 1280 KB
subtask_01_13.txt AC 19 ms 768 KB
subtask_01_14.txt AC 1 ms 640 KB
subtask_01_15.txt AC 18 ms 896 KB
subtask_01_16.txt AC 28 ms 1152 KB
subtask_01_17.txt AC 26 ms 896 KB
subtask_01_18.txt AC 31 ms 896 KB