結果
問題 | No.689 E869120 and Constructing Array 3 |
ユーザー |
![]() |
提出日時 | 2019-07-20 11:59:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 815 bytes |
コンパイル時間 | 1,949 ms |
コンパイル使用メモリ | 170,720 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-29 17:26:07 |
合計ジャッジ時間 | 3,612 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
#include "bits/stdc++.h" using namespace std; typedef long long ll; void Say(bool say, string a = "Yes", string b = "No"){cout << (say ? a : b) << endl;}; vector<ll>ans; void out(){ cout << ans.size() << endl; for(ll i = 0; i < ans.size(); i++){ cout << ans[i]; if(i + 1 == ans.size())cout << endl; else cout << " "; } } int main(){ ll K; cin >> K; ll I = 1; for(;;){ ll tmp = I + 1; if(tmp * (tmp - 1) / 2 > K)break; I++; } for(ll i = 0; i < I; i++)ans.push_back(1); K -= I * (I - 1) / 2; if(K >= 100){ for(ll i = 0; i < 10; i++)ans.push_back(8); for(ll i = 0; i < 10; i++)ans.push_back(9); K -= 100; } ans.push_back(13); for(;K;K--)ans.push_back(24); out(); return 0; }