結果
問題 |
No.1837 Same but Different
|
ユーザー |
![]() |
提出日時 | 2021-12-12 12:27:53 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 681 bytes |
コンパイル時間 | 995 ms |
コンパイル使用メモリ | 90,556 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-20 23:03:24 |
合計ジャッジ時間 | 3,687 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 12 WA * 11 |
ソースコード
#include <iostream> #include <numeric> #include <vector> using namespace std; int main() { cin.tie(nullptr), ios::sync_with_stdio(false); int N; cin >> N; int p = 3; // [0, 0, 0, 0, ..., 0] vs. [1, 1, 1, 1, ..., -(N - 1)] while ((N - 2) % p == 0) ++p; vector<int> A, B; for (int i = 1; i <= 10000; ++i) { if (i % p == 0 and int(A.size()) < N) A.push_back(i); if (i % p == 1 and int(B.size()) < N - 1) B.push_back(i); } B.push_back(accumulate(A.begin(), A.end(), 0LL) - accumulate(B.begin(), B.end(), 0LL)); for (auto x : A) cout << x << ' '; cout << '\n'; for (auto x : B) cout << x << ' '; cout << '\n'; }