結果

問題 No.2221 Set X
ユーザー ripityripity
提出日時 2024-01-15 02:19:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 339 ms / 2,000 ms
コード長 691 bytes
コンパイル時間 2,075 ms
コンパイル使用メモリ 203,564 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-15 02:19:34
合計ジャッジ時間 10,184 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 AC 104 ms
6,676 KB
testcase_17 AC 36 ms
6,676 KB
testcase_18 AC 121 ms
6,676 KB
testcase_19 AC 31 ms
6,676 KB
testcase_20 AC 68 ms
6,676 KB
testcase_21 AC 145 ms
6,676 KB
testcase_22 AC 205 ms
6,676 KB
testcase_23 AC 11 ms
6,676 KB
testcase_24 AC 132 ms
6,676 KB
testcase_25 AC 79 ms
6,676 KB
testcase_26 AC 234 ms
6,676 KB
testcase_27 AC 296 ms
6,676 KB
testcase_28 AC 296 ms
6,676 KB
testcase_29 AC 333 ms
6,676 KB
testcase_30 AC 322 ms
6,676 KB
testcase_31 AC 329 ms
6,676 KB
testcase_32 AC 324 ms
6,676 KB
testcase_33 AC 325 ms
6,676 KB
testcase_34 AC 325 ms
6,676 KB
testcase_35 AC 326 ms
6,676 KB
testcase_36 AC 339 ms
6,676 KB
testcase_37 AC 330 ms
6,676 KB
testcase_38 AC 331 ms
6,676 KB
testcase_39 AC 260 ms
6,676 KB
testcase_40 AC 315 ms
6,676 KB
testcase_41 AC 333 ms
6,676 KB
testcase_42 AC 328 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }
    vector<int> f(2*N);
    for( int x = 1; x <= 2*N; x++ ) {
        int cnt = 0, pos = 0;
        while( (x+1)*cnt <= 2*N && pos < N ) {
            int ok = pos, ng = N;
            while( ok+1 < ng ) {
                int k = (ok+ng)/2;
                if( A[pos]/x == A[k]/x ) ok = k;
                else ng = k;
            }
            cnt++;
            pos = ok+1;
        }
        f[x-1] = (x+1)*cnt;
    }
    auto itr = min_element(f.begin(), f.end());
    cout << itr-f.begin()+1 << "\n" << *itr << endl;
}
0