結果
問題 | No.1571 All Your Cycles Are Same Lengths |
ユーザー | risujiroh |
提出日時 | 2021-06-27 13:16:56 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 832 bytes |
コンパイル時間 | 2,020 ms |
コンパイル使用メモリ | 198,436 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-07 17:32:45 |
合計ジャッジ時間 | 3,543 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,384 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | WA | - |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | WA | - |
testcase_07 | AC | 2 ms
4,380 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
ソースコード
#include <bits/stdc++.h> int main() { using namespace std; cin.tie(nullptr)->sync_with_stdio(false); int tt; cin >> tt; while (tt--) { int n, target; cin >> n >> target; if (~target & 1) { cout << "Yes\n"; for (int i = 1; i < n; ++i) for (int j = i + 1; j <= n; ++j) cout << i << ' ' << j << ' ' << (i == 1 ? target / 2 : 0) << '\n'; } else if (target % n == 0) { cout << "Yes\n"; for (int i = 1; i < n; ++i) for (int j = i + 1; j <= n; ++j) cout << i << ' ' << j << ' ' << target / n << '\n'; } else if (n == 3) { cout << "Yes\n"; for (int i = 1; i < n; ++i) for (int j = i + 1; j <= n; ++j) cout << i << ' ' << j << ' ' << (i == 1 and j == 2 ? target : 0) << '\n'; } else { cout << "No\n"; } } }