結果
問題 | No.688 E869120 and Constructing Array 2 |
ユーザー |
![]() |
提出日時 | 2018-05-22 16:38:21 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 744 bytes |
コンパイル時間 | 582 ms |
コンパイル使用メモリ | 75,212 KB |
実行使用メモリ | 13,756 KB |
最終ジャッジ日時 | 2024-07-07 14:03:33 |
合計ジャッジ時間 | 4,375 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | TLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:45:21: warning: ‘b’ may be used uninitialized [-Wmaybe-uninitialized] 45 | cout << (a+b) << endl; | ^
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <numeric> #include <map> #include <set> #include <complex> using namespace std; #define REP(i,n) for(int i=0;i<(n);++i) #define REPS(i,s,t) for(int i=(s);i<(t);++i) #define INF 2000000007 #define MOD 1000000007 #define MAX 200005 typedef unsigned int uint; typedef unsigned long long int ull; typedef long long int ll; int dp[MAX]; int main(){ int K;cin>>K; int a=1,N=K; while(K%2==0){ K/=2; a++; } int b; while(K<N){ double t = sqrt(1+8*K); if(ceil(t) == floor(t)){ b = (t+1)/2; break; } K*=2; --a; } cout << (a+b) << endl; REP(i,a) cout << 0 << " "; REP(i,b) cout << 1 << " "; cout << endl; return 0; }