提出 #38620359


ソースコード 拡げる

#include <cstdio>
using namespace std;

int main() {
  int N, A[531441];
  scanf("%d", &N);
  int M = 1;
  for (int i = 0; i < N; i++) M *= 3;
  for (int i = 0; i < M; i++) scanf("%d", A + i);
  auto f = [&](int &x, int &y, int &z) {
    int nx = y - z;
    int ny = x - y + z;
    int nz = -x + y;
    x = nx, y = ny, z = nz;
  };
  for (int i = 1; i < M; i *= 3) {
    for (int js = 0; js < M; js += i * 3) {
      for (int j = js; j < js + i; j++) {
        f(A[j], A[j + i], A[j + i * 2]);
      }
    }
  }
  for (int i = 0; i < M; i++) printf("%d ", A[i]);
}

提出情報

提出日時
問題 G - 3^N Minesweeper
ユーザ Nyaan
言語 C++ (GCC 9.2.1)
得点 600
コード長 589 Byte
結果 AC
実行時間 86 ms
メモリ 3772 KiB

コンパイルエラー

./Main.cpp: In function ‘int main()’:
./Main.cpp:6:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    6 |   scanf("%d", &N);
      |   ~~~~~^~~~~~~~~~
./Main.cpp:9:36: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    9 |   for (int i = 0; i < M; i++) scanf("%d", A + i);
      |                               ~~~~~^~~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 600 / 600
結果 AC
AC × 37
セット名 テストケース
Sample
All sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt, testcase24.txt, testcase25.txt, testcase26.txt, testcase27.txt, testcase28.txt, testcase29.txt, testcase30.txt, testcase31.txt, testcase32.txt, testcase33.txt
ケース名 結果 実行時間 メモリ
sample00.txt AC 6 ms 1652 KiB
sample01.txt AC 1 ms 1696 KiB
sample02.txt AC 1 ms 1668 KiB
testcase00.txt AC 72 ms 3684 KiB
testcase01.txt AC 84 ms 3760 KiB
testcase02.txt AC 73 ms 3692 KiB
testcase03.txt AC 83 ms 3696 KiB
testcase04.txt AC 82 ms 3732 KiB
testcase05.txt AC 82 ms 3728 KiB
testcase06.txt AC 82 ms 3704 KiB
testcase07.txt AC 81 ms 3684 KiB
testcase08.txt AC 74 ms 3688 KiB
testcase09.txt AC 77 ms 3716 KiB
testcase10.txt AC 82 ms 3724 KiB
testcase11.txt AC 82 ms 3772 KiB
testcase12.txt AC 83 ms 3692 KiB
testcase13.txt AC 80 ms 3688 KiB
testcase14.txt AC 76 ms 3688 KiB
testcase15.txt AC 78 ms 3716 KiB
testcase16.txt AC 4 ms 1628 KiB
testcase17.txt AC 1 ms 1616 KiB
testcase18.txt AC 1 ms 1624 KiB
testcase19.txt AC 2 ms 1620 KiB
testcase20.txt AC 1 ms 1616 KiB
testcase21.txt AC 1 ms 1664 KiB
testcase22.txt AC 1 ms 1624 KiB
testcase23.txt AC 3 ms 1720 KiB
testcase24.txt AC 8 ms 1696 KiB
testcase25.txt AC 20 ms 1864 KiB
testcase26.txt AC 39 ms 2312 KiB
testcase27.txt AC 86 ms 3720 KiB
testcase28.txt AC 86 ms 3764 KiB
testcase29.txt AC 83 ms 3692 KiB
testcase30.txt AC 85 ms 3692 KiB
testcase31.txt AC 84 ms 3768 KiB
testcase32.txt AC 85 ms 3684 KiB
testcase33.txt AC 84 ms 3736 KiB