結果

問題 No.994 ばらばらコイン
ユーザー gyouzasushigyouzasushi
提出日時 2020-02-21 21:26:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 1,172 bytes
コンパイル時間 1,647 ms
コンパイル使用メモリ 166,272 KB
実行使用メモリ 8,960 KB
最終ジャッジ日時 2024-04-17 07:08:36
合計ジャッジ時間 3,365 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 70 ms
8,832 KB
testcase_03 AC 81 ms
8,832 KB
testcase_04 AC 81 ms
8,960 KB
testcase_05 AC 39 ms
6,272 KB
testcase_06 AC 80 ms
8,832 KB
testcase_07 AC 81 ms
8,832 KB
testcase_08 AC 54 ms
7,040 KB
testcase_09 AC 76 ms
8,448 KB
testcase_10 AC 57 ms
7,040 KB
testcase_11 AC 63 ms
7,552 KB
testcase_12 AC 68 ms
7,936 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 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
int main() {
    int n, k;
    cin >> n >> k;
    vector<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)
        cout << -1 << endl;
    else
        cout << k - 1 << endl;
}
0