結果

問題 No.689 E869120 and Constructing Array 3
ユーザー yosupotyosupot
提出日時 2018-05-18 23:38:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,499 bytes
コンパイル時間 960 ms
コンパイル使用メモリ 111,420 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-10 23:15:57
合計ジャッジ時間 3,674 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

V<ll> v = {9, 22, 70, 37, 95, 12};

using P = pair<int, int>;
P ck(ll k, ll a) {
    int ma = -1;
    P res;
    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= a; j++) {
            int z = i*j;
            if (k < z) continue;
            if (ma < z) {
                ma = z;
                res = P(i, j);
            }
        }
    }
    return res;
}

V<ll> ans;
void push(P p, ll a, ll b) {
    for (int i = 0; i < p.first; i++) {
        ans.push_back(a);
    }
    for (int i = 0; i < p.second; i++) {
        ans.push_back(b);
    }
}


int main() {
    ll k;
    cin >> k;
    P p1 = ck(k, 100);
    k -= p1.first*p1.second;
    P p2 = ck(k, 10);
    k -= p2.first*p2.second;
    P p3 = ck(k, 10);
    k -= p3.first*p3.second;
    push(p1, v[0], v[1]);
    push(p2, v[2], v[3]);
    push(p3, v[4], v[5]);

    cout << ans.size() << endl;
    for (ll d: ans) {
        cout << d << " ";
    }
    cout << endl;
}
0