結果

問題 No.994 ばらばらコイン
ユーザー leaf_1415leaf_1415
提出日時 2020-02-21 22:01:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 59,612 KB
実行使用メモリ 9,472 KB
最終ジャッジ日時 2024-04-17 07:37:17
合計ジャッジ時間 1,761 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,760 KB
testcase_01 AC 3 ms
5,760 KB
testcase_02 AC 29 ms
8,832 KB
testcase_03 AC 37 ms
9,472 KB
testcase_04 AC 35 ms
9,344 KB
testcase_05 AC 17 ms
7,552 KB
testcase_06 AC 31 ms
9,472 KB
testcase_07 AC 30 ms
9,472 KB
testcase_08 AC 23 ms
8,192 KB
testcase_09 AC 31 ms
8,960 KB
testcase_10 AC 23 ms
8,320 KB
testcase_11 AC 25 ms
8,576 KB
testcase_12 AC 26 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,888 KB
testcase_16 AC 3 ms
5,632 KB
testcase_17 AC 4 ms
5,760 KB
testcase_18 AC 4 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,888 KB
testcase_22 AC 3 ms
5,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#define llint long long

using namespace std;

llint n, k;
vector<llint> G[100005];

int main(void)
{
  ios::sync_with_stdio(0);
  cin.tie(0);

  cin >> n >> k;
  llint u, v;
  for(int i = 0; i < n-1; i++){
    cin >> u >> v;
    G[u].push_back(v);
    G[v].push_back(u);
  }

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

  return 0;
}
0