結果
| 問題 |
No.1837 Same but Different
|
| コンテスト | |
| ユーザー |
houren
|
| 提出日時 | 2022-02-11 23:12:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 955 bytes |
| コンパイル時間 | 1,654 ms |
| コンパイル使用メモリ | 168,628 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 21:31:50 |
| 合計ジャッジ時間 | 2,765 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}
int main(){
int n;
cin >> n;
int x = n%3;
if(x==0){
rep(i,n) cout << (i+(i>=n/3*2))*3 << " ";
cout << endl;
rep(i,n) cout << i*3+1 << " ";
cout << endl;
}else if(x==1){
cout << 1 << " ";
rep(i,n-1) cout << (i+2+(i+1>=n/3*2))*3 << " ";
cout << endl;
rep(i,n) cout << (i+1)*3+1 << " ";
cout << endl;
}else{
n -= 5;
cout << "1 4 15 21 24 ";
rep(i,n) cout << (i+9+(i>=n/3*2))*3 << " ";
cout << endl << "7 10 13 16 19 ";
rep(i,n) cout << i*3+28 << " ";
cout << endl;
}
return 0;
}
houren