結果
| 問題 | 
                            No.994 ばらばらコイン
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-02-21 21:26:12 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 375 bytes | 
| コンパイル時間 | 2,050 ms | 
| コンパイル使用メモリ | 169,620 KB | 
| 実行使用メモリ | 8,960 KB | 
| 最終ジャッジ日時 | 2024-10-08 20:43:56 | 
| 合計ジャッジ時間 | 5,257 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 RE * 12 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    int n,k;
    cin>>n>>k;
    vector<vector<int>> g(n);
    for (int i = 0; i < n-1; ++i) {
        int a,b;
        cin>>a>>b;
        g[a].emplace_back(b);
        g[b].emplace_back(a);
    }
    if(k>n){
        cout<<-1<<endl;
    }
    else{
        cout<<k-1<<endl;
    }
    return 0;
}