結果

問題 No.994 ばらばらコイン
ユーザー tanimani364tanimani364
提出日時 2020-02-21 21:26:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,351 bytes
コンパイル時間 1,478 ms
コンパイル使用メモリ 139,260 KB
実行使用メモリ 5,760 KB
最終ジャッジ日時 2024-04-17 07:09:14
合計ジャッジ時間 6,432 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'void solve()':
main.cpp:70:6: warning: 'a' may be used uninitialized [-Wmaybe-uninitialized]
   70 |     a--;b--;
      |     ~^~
main.cpp:69:9: note: 'a' declared here
   69 |     int a,b;
      |         ^
main.cpp:70:10: warning: 'b' may be used uninitialized [-Wmaybe-uninitialized]
   70 |     a--;b--;
      |         ~^~
main.cpp:69:11: note: 'b' declared here
   69 |     int a,b;
      |           ^

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;

//ここから

void solve(){
  int n,k;
  cin>>n>>k;
  vector<vector<int>>g(n);
  rep(i,n-1){
    int a,b;
    a--;b--;
    g[a].pb(b);
    g[b].pb(a);
  }
  if(n<k)cout<<-1<<endl;
  else cout<<k-1<<endl;
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}
0