結果

問題 No.994 ばらばらコイン
ユーザー Y17Y17
提出日時 2020-02-21 21:35:30
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 355 bytes
コンパイル時間 1,322 ms
コンパイル使用メモリ 160,852 KB
実行使用メモリ 9,600 KB
最終ジャッジ日時 2024-04-17 07:28:40
合計ジャッジ時間 2,807 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,760 KB
testcase_01 AC 3 ms
5,632 KB
testcase_02 AC 68 ms
8,832 KB
testcase_03 AC 73 ms
9,472 KB
testcase_04 AC 71 ms
9,600 KB
testcase_05 AC 35 ms
7,680 KB
testcase_06 AC 73 ms
9,472 KB
testcase_07 AC 70 ms
9,472 KB
testcase_08 AC 51 ms
8,192 KB
testcase_09 AC 68 ms
9,344 KB
testcase_10 AC 50 ms
8,320 KB
testcase_11 AC 58 ms
8,576 KB
testcase_12 AC 61 ms
8,832 KB
testcase_13 AC 3 ms
5,760 KB
testcase_14 AC 3 ms
5,760 KB
testcase_15 AC 3 ms
5,632 KB
testcase_16 AC 3 ms
5,504 KB
testcase_17 AC 3 ms
5,632 KB
testcase_18 AC 3 ms
5,760 KB
testcase_19 AC 3 ms
5,760 KB
testcase_20 AC 3 ms
5,632 KB
testcase_21 AC 3 ms
5,504 KB
testcase_22 AC 3 ms
5,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int long long

vector<int> tree[100010];

signed main(){
	int n, k;
	cin >> n >> k;
	for(int i = 0;i < n-1;i++){
		int a, b;
		cin >> a >> b;
		a--; b--;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}

	if(n < k){
		cout << -1 << endl;
		return 0;
	}else{
		cout << k-1 << endl;
	}

	return 0;
}
0