結果

問題 No.1837 Same but Different
ユーザー 👑 Nachia
提出日時 2022-02-11 23:11:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,231 bytes
コンパイル時間 1,979 ms
コンパイル使用メモリ 108,576 KB
最終ジャッジ日時 2025-01-27 22:08:47
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <atcoder/modint>
#include <atcoder/convolution>
using namespace std;


using i64 = long long;
using u64 = unsigned long long;
using i32 = int;
using u32 = unsigned int;
#define rep(i,n) for(int i=0; i<(int)(n); i++)



int main() {
    int N; cin >> N;
    int l = 111, r = 9960;
    vector<int> A; // A[i] mod 3 = 0
    vector<int> B; // B[i] mod 3 = 1
    while(3 <= N){
        A.push_back(l); B.push_back(l+1); l += 3;
        A.push_back(l); B.push_back(l+1); l += 3;
        A.push_back(r); B.push_back(r-2); r -= 3;
        N -= 3;
    }

    if(N == 1){
        B.back() -= 6;
        A.push_back(1); B.push_back(7);
        N = 0;
    }
    if(N == 2){
        B.back() -= 12;
        A.push_back(1); B.push_back(7);
        A.push_back(4); B.push_back(10);
        N = 0;
    }

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    rep(i,A.size()){ if(i) cout << ' '; cout << A[i]; } cout << '\n';
    rep(i,B.size()){ if(i) cout << ' '; cout << B[i]; } cout << '\n';
    return 0;
}




struct ios_do_not_sync{
    ios_do_not_sync(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(nullptr);
    }
} ios_do_not_sync_instance;
0