結果
問題 |
No.2991 Hypercubic Graph Flow
|
ユーザー |
![]() |
提出日時 | 2024-12-16 19:56:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 899 bytes |
コンパイル時間 | 523 ms |
コンパイル使用メモリ | 41,084 KB |
最終ジャッジ日時 | 2025-02-26 14:47:43 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:28:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | scanf("%d", &n); | ~~~~~^~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*- * * 2991.cc: No.2991 Hypercubic Graph Flow - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 10; const int NBITS = 1 << MAX_N; /* typedef */ /* global variables */ int as[MAX_N], fs[NBITS][NBITS]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); if (n == 1) { puts("No"); return 0; } if (n & 1) { as[0] = 2, as[1] = as[2] = -1; for (int i = 3; i < n; i++) as[i] = (i & 1) * 2 - 1; } else { for (int i = 0; i < n; i++) as[i] = 1 - (i & 1) * 2; } int nbits = 1 << n; for (int i = 0; i < nbits; i++) for (int j = 0, bj = 1; j < n; j++, bj <<= 1) fs[i][i ^ bj] = as[j]; puts("Yes"); for (int i = 0; i < nbits; i++) for (int j = 0; j < nbits; j++) printf("%d%c", fs[i][j], (j + 1 < nbits) ? ' ' : '\n'); return 0; }