結果
| 問題 | No.1523 +/- Tree |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-05-28 21:54:42 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 672 bytes |
| 記録 | |
| コンパイル時間 | 1,761 ms |
| コンパイル使用メモリ | 194,164 KB |
| 最終ジャッジ日時 | 2025-01-21 20:02:00 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 37 WA * 7 |
ソースコード
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int BASE=1000000;
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;
}
}