結果

問題 No.330 Eigenvalue Decomposition
ユーザー chocoruskchocorusk
提出日時 2018-10-27 07:16:37
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 252 ms / 5,000 ms
コード長 753 bytes
コンパイル時間 856 ms
コンパイル使用メモリ 98,220 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-29 22:11:42
合計ジャッジ時間 4,669 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
9,084 KB
testcase_01 AC 3 ms
5,888 KB
testcase_02 AC 5 ms
5,888 KB
testcase_03 AC 92 ms
9,212 KB
testcase_04 AC 4 ms
5,888 KB
testcase_05 AC 3 ms
5,888 KB
testcase_06 AC 109 ms
10,624 KB
testcase_07 AC 4 ms
5,888 KB
testcase_08 AC 71 ms
8,960 KB
testcase_09 AC 168 ms
8,320 KB
testcase_10 AC 3 ms
5,760 KB
testcase_11 AC 54 ms
6,656 KB
testcase_12 AC 207 ms
8,960 KB
testcase_13 AC 3 ms
5,760 KB
testcase_14 AC 56 ms
6,784 KB
testcase_15 AC 10 ms
6,272 KB
testcase_16 AC 4 ms
5,632 KB
testcase_17 AC 7 ms
5,888 KB
testcase_18 AC 40 ms
7,296 KB
testcase_19 AC 3 ms
5,504 KB
testcase_20 AC 11 ms
6,144 KB
testcase_21 AC 252 ms
11,008 KB
testcase_22 AC 7 ms
5,888 KB
testcase_23 AC 17 ms
6,144 KB
testcase_24 AC 168 ms
8,192 KB
testcase_25 AC 3 ms
5,760 KB
testcase_26 AC 9 ms
5,888 KB
testcase_27 AC 4 ms
5,888 KB
testcase_28 AC 3 ms
5,888 KB
testcase_29 AC 3 ms
5,888 KB
testcase_30 AC 3 ms
5,760 KB
testcase_31 AC 4 ms
5,760 KB
testcase_32 AC 3 ms
5,760 KB
testcase_33 AC 4 ms
5,760 KB
testcase_34 AC 3 ms
5,632 KB
testcase_35 AC 3 ms
5,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
vector<int> g[100000];
bool used[100000];
void dfs(int x){
	used[x]=1;
	for(auto y:g[x]){
		if(!used[y]) dfs(y);
	}
}

int main()
{
	int n, m;
	cin>>n>>m;
	for(int i=0; i<m; i++){
		int a, b, c; cin>>a>>b>>c;
		a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	int ans=0;
	for(int i=0; i<n; i++){
		if(!used[i]){
			dfs(i);
			ans++;
		}
	}
	cout<<ans<<endl;
    return 0;
}
0