結果

問題 No.994 ばらばらコイン
ユーザー tsutajtsutaj
提出日時 2020-02-21 21:25:31
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 1,275 bytes
コンパイル時間 1,095 ms
コンパイル使用メモリ 104,388 KB
実行使用メモリ 9,088 KB
最終ジャッジ日時 2024-04-17 07:07:31
合計ジャッジ時間 2,111 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 31 ms
8,832 KB
testcase_03 AC 38 ms
9,088 KB
testcase_04 AC 35 ms
8,832 KB
testcase_05 AC 19 ms
6,272 KB
testcase_06 AC 34 ms
8,880 KB
testcase_07 AC 36 ms
8,960 KB
testcase_08 AC 25 ms
7,168 KB
testcase_09 AC 35 ms
8,576 KB
testcase_10 AC 27 ms
7,296 KB
testcase_11 AC 29 ms
7,680 KB
testcase_12 AC 33 ms
8,064 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int N, K; scanf("%d%d", &N, &K);
    vector< vector<int> > G(N);
    for(int i=0; i+1<N; i++) {
        int u, v; scanf("%d%d", &u, &v);
        u--; v--;
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }

    if(N < K) {
        cout << -1 << endl;
        return 0;
    }
    else {
        cout << K - 1 << endl;
    }
    return 0;
}
0