結果

問題 No.1114 足し算盆に返らず
ユーザー kyo1
提出日時 2020-07-18 22:45:15
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 457 bytes
コンパイル時間 1,979 ms
コンパイル使用メモリ 197,092 KB
最終ジャッジ日時 2025-01-12 00:35:18
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 17 TLE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> res;
  vector<bool> ok(2 * N + 2, true);
  for (int i = 1; i < N + 1; i++) {
    if (ok[i]) {
      res.emplace_back(i);
      ok[i + i] = false;
      for (int r : res) {
        ok[i + r] = false;
      }
    }
  }
  for (const auto &v : res) {
    cout << v << (&v == &res.back() ? '\n' : ' ');
  }
  return 0;
}
0