結果

問題 No.994 ばらばらコイン
ユーザー outlineoutline
提出日時 2020-03-04 20:17:40
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 1,206 bytes
コンパイル時間 1,160 ms
コンパイル使用メモリ 109,360 KB
実行使用メモリ 9,128 KB
最終ジャッジ日時 2023-08-04 03:19:12
合計ジャッジ時間 3,190 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,720 KB
testcase_01 AC 4 ms
5,944 KB
testcase_02 AC 30 ms
8,944 KB
testcase_03 AC 41 ms
9,108 KB
testcase_04 AC 40 ms
9,108 KB
testcase_05 AC 20 ms
7,344 KB
testcase_06 AC 40 ms
8,936 KB
testcase_07 AC 41 ms
9,128 KB
testcase_08 AC 28 ms
7,932 KB
testcase_09 AC 38 ms
8,708 KB
testcase_10 AC 27 ms
7,976 KB
testcase_11 AC 32 ms
8,468 KB
testcase_12 AC 35 ms
8,516 KB
testcase_13 AC 3 ms
5,788 KB
testcase_14 AC 3 ms
5,708 KB
testcase_15 AC 3 ms
5,704 KB
testcase_16 AC 3 ms
5,728 KB
testcase_17 AC 4 ms
5,672 KB
testcase_18 AC 4 ms
5,744 KB
testcase_19 AC 4 ms
5,720 KB
testcase_20 AC 4 ms
5,804 KB
testcase_21 AC 3 ms
5,700 KB
testcase_22 AC 3 ms
5,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-15;
constexpr int INF = 1001001001;
constexpr int mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

vector<int> graph[100005];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, k;
    cin >> n >> k;
    for(int i = 0; i < n - 1; ++i){
        int a, b;
        cin >> a >> b;
        --a, --b;
        graph[a].emplace_back(b);
        graph[b].emplace_back(a);
    }
    if(n < k)   cout << -1 << endl;
    else    cout << k - 1 << endl;
}
0