結果

問題 No.1837 Same but Different
ユーザー SSRS
提出日時 2022-02-11 21:50:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 631 bytes
コンパイル時間 2,176 ms
コンパイル使用メモリ 195,284 KB
最終ジャッジ日時 2025-01-27 21:28:35
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 + 1) / 3; i++){
    A.push_back(i * 3);
    B.push_back(i * 3 + 1);
  }
  for (int i = (N * 2 + 1) / 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] += 3;
    B[N - 1]++;
  }
  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