結果

問題 No.994 ばらばらコイン
ユーザー misora192misora192
提出日時 2020-04-18 08:13:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 403 bytes
コンパイル時間 1,609 ms
コンパイル使用メモリ 165,684 KB
実行使用メモリ 9,208 KB
最終ジャッジ日時 2024-04-14 20:17:17
合計ジャッジ時間 3,446 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 31 ms
8,960 KB
testcase_03 AC 36 ms
9,064 KB
testcase_04 AC 39 ms
9,088 KB
testcase_05 AC 18 ms
6,940 KB
testcase_06 WA -
testcase_07 AC 37 ms
8,960 KB
testcase_08 AC 25 ms
7,168 KB
testcase_09 AC 35 ms
8,832 KB
testcase_10 AC 26 ms
7,296 KB
testcase_11 AC 29 ms
7,936 KB
testcase_12 AC 31 ms
8,192 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, k;
	cin >> n >> k;

	vector<int> g[n];
	rep(i, n - 1){
		int a, b;
		cin >> a >> b;
		a--;
		b--;

		g[a].push_back(b);
		g[b].push_back(a);
	}

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

	cout << k - 1 << endl;
}
0