結果

問題 No.689 E869120 and Constructing Array 3
ユーザー bachoppibachoppi
提出日時 2020-08-22 18:41:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 995 bytes
コンパイル時間 1,420 ms
コンパイル使用メモリ 128,196 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-23 12:09:11
合計ジャッジ時間 2,968 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 WA -
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
      |                        ^~~~

ソースコード

diff #

#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.141592653589793238462643383279




int 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;
}
0