結果
問題 | No.689 E869120 and Constructing Array 3 |
ユーザー |
![]() |
提出日時 | 2020-08-22 18:41:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 995 bytes |
コンパイル時間 | 1,717 ms |
コンパイル使用メモリ | 127,168 KB |
最終ジャッジ日時 | 2025-01-13 11:33:51 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 WA * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:19:43: warning: ‘ichi’ may be used uninitialized [-Wmaybe-uninitialized] 19 | #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) | ^ main.cpp:20:18: note: in expansion of macro ‘REP’ 20 | #define rep(i,n) REP(i,0,n) | ^~~ main.cpp:40:3: note: in expansion of macro ‘rep’ 40 | rep(i, ichi){ | ^~~ main.cpp:34:24: note: ‘ichi’ was declared here 34 | int K; cin >> K; int ichi; | ^~~~
ソースコード
#pragma GCC optimize("Ofast")#include<iostream>#include<string>#include<algorithm>#include<vector>#include<iomanip>#include<math.h>#include<complex>#include<queue>#include<deque>#include<stack>#include<map>#include<set>#include<bitset>#include<functional>#include<assert.h>#include<numeric>using namespace std;#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )#define rep(i,n) REP(i,0,n)using ll = long long;const int inf=1e9+7;const ll longinf=1LL<<60 ;const ll mod=1e9+7 ;#define pai 3.141592653589793238462643383279int main(){cin.tie(0);ios::sync_with_stdio(0);vector<int> ans;int K; cin >> K; int ichi;for(int i=1; i<150; i++){if(i*(i-1)/2>K){ichi = i-1; break;}}rep(i, ichi){ans.push_back(1);}ans.push_back(3);int ima = ichi*(ichi-1)/2;//cout << ima << endl;rep(i, K-ima){ans.push_back(8);}cout << ans.size() << endl;for(auto k: ans){cout << k << " ";}cout << endl;}