結果
問題 | No.1571 All Your Cycles Are Same Lengths |
ユーザー |
![]() |
提出日時 | 2021-06-27 14:37:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 912 bytes |
コンパイル時間 | 2,035 ms |
コンパイル使用メモリ | 194,412 KB |
最終ジャッジ日時 | 2025-01-22 14:22:56 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 WA * 6 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int Q;cin >> Q;while (Q--) {int N,T;cin >> N >> T;if(T%2 != 0 && T%N != 0) {cout << "No" << endl;}else if(T%N == 0) {cout << "Yes" << endl;for(int i = 1; i <= N; i++) {for(int j = i+1; j <= N; j++) {cout << i << " " << j << " " << T/N << endl;}}}else {cout << "Yes" << endl;for(int i = 1; i <= N; i++) {for(int j = i+1; j <= N; j++) {if(i == 1) {cout << i << " " << j << " " << T/2 << endl;}else {cout << i << " " << j << " " << 0 << endl;}}}}}}