結果
| 問題 |
No.1523 +/- Tree
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-05-28 21:55:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 671 bytes |
| コンパイル時間 | 2,367 ms |
| コンパイル使用メモリ | 193,880 KB |
| 最終ジャッジ日時 | 2025-01-21 20:02:24 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 44 |
ソースコード
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int BASE=100000;
signed main(){
int N,K; cin>>N>>K;
if(K==N-1 || K==1)return puts("No"),0;
if(K==2 && N%2==1)return puts("No"),0;
puts("Yes");
if(K==2){
for(int i=0;i<N-1;i++){
if(i%2==0)cout<<i+1<<' '<<i+2<<' '<<BASE-1<<endl;
else cout<<i+1<<' '<<i+2<<' '<<-BASE<<endl;
}
}else{
for(int i=0;i<K;i++){
if(i==0)cout<<i+1<<' '<<i+2<<' '<<BASE*(K-1)-1<<endl;
else cout<<i+1<<' '<<i+2<<' '<<-BASE<<endl;
}
for(int i=K;i<N-1;i++)cout<<K+1<<' '<<i+2<<' '<<' '<<BASE*(K-1)-1<<endl;
}
}