結果
問題 | No.2991 Hypercubic Graph Flow |
ユーザー |
![]() |
提出日時 | 2024-12-16 17:02:18 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 75 ms / 2,000 ms |
コード長 | 843 bytes |
コンパイル時間 | 2,535 ms |
コンパイル使用メモリ | 205,996 KB |
実行使用メモリ | 7,424 KB |
最終ジャッジ日時 | 2024-12-16 17:02:22 |
合計ジャッジ時間 | 4,068 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <bits/stdc++.h>using namespace std;void fast_io() {ios::sync_with_stdio(false);std::cin.tie(nullptr);}int main() {fast_io();int n;cin >> n;if (n == 1) {cout << "No" << endl;return 0;}cout << "Yes" << endl;vector<vector<int>> ans(1 << n, vector<int>(1 << n));for (int i = 0; i < (1 << n); i++) {for (int j = 0; j < n; j++) {if (j % 2 == __builtin_popcount(i) % 2) {ans[i][i ^ (1 << j)] = 1;} else {ans[i][i ^ (1 << j)] = -1;}if (n % 2) {if (j == n - 2) {ans[i][i ^ (1 << (n - 1))] *= -1;}if (j == n - 1) {ans[i][i ^ (1 << (n - 2))] *= 2;}}}}for (int i = 0; i < (1 << n); i++) {long long su = 0;for (int j = 0; j < (1 << n); j++) {cout << ans[i][j] << " ";su += ans[i][j];}cout << "\n";assert(su == 0);}}