結果

問題 No.1528 Not 1
ユーザー risujirohrisujiroh
提出日時 2021-06-04 20:50:15
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 1,767 ms
コンパイル使用メモリ 192,708 KB
最終ジャッジ日時 2025-01-21 22:37:49
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int main() {
  using namespace std;
  cin.tie(nullptr)->sync_with_stdio(false);
  int n;
  cin >> n;
  if (n & 1) {
    if (n == 1) {
      cout << "1\n";
    } else if (n == 3 or n == 5) {
      cout << "-1\n";
    } else {
      cout << "3 6 4 2";
      for (int i = 8; i < n; i += 2) cout << ' ' << i;
      cout << '\n';
    }
  } else {
    for (int i = 2; i <= n; i += 2) cout << i << " \n"[i == n];
  }
}
0