結果

問題 No.1837 Same but Different
ユーザー SSRS
提出日時 2022-02-11 21:55:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 634 bytes
コンパイル時間 2,052 ms
コンパイル使用メモリ 195,104 KB
最終ジャッジ日時 2025-01-27 21:30:40
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 15 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A, B;
  for (int i = 0; i < (N * 2 + 2) / 3; i++){
    A.push_back(i * 3);
    B.push_back(i * 3 + 1);
  }
  for (int i = (N * 2 + 2) / 3; i < N; i++){
    A.push_back(i * 3 + 3);
    B.push_back(i * 3 + 1);
  }
  if (N % 3 == 1){
    A[N - 1]++;
  }
  if (N % 3 == 2){
    A[N - 1] -= 2;
    B[N - 1] += 4;
  }
  for (int i = 0; i < N; i++){
    cout << A[i];
    if (i < N - 1){
      cout << ' ';
    }
  }
  cout << endl;
  for (int i = 0; i < N; i++){
    cout << B[i];
    if (i < N - 1){
      cout << ' ';
    }
  }
  cout << endl;
}
0