結果

問題 No.2221 Set X
ユーザー ripityripity
提出日時 2024-01-15 02:18:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 687 bytes
コンパイル時間 2,734 ms
コンパイル使用メモリ 203,692 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-15 02:19:11
合計ジャッジ時間 12,036 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 WA -
testcase_05 AC 2 ms
6,676 KB
testcase_06 WA -
testcase_07 AC 2 ms
6,676 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
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 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 126 ms
6,676 KB
testcase_22 AC 178 ms
6,676 KB
testcase_23 AC 11 ms
6,676 KB
testcase_24 AC 115 ms
6,676 KB
testcase_25 AC 70 ms
6,676 KB
testcase_26 AC 209 ms
6,676 KB
testcase_27 AC 252 ms
6,676 KB
testcase_28 AC 252 ms
6,676 KB
testcase_29 AC 298 ms
6,676 KB
testcase_30 AC 280 ms
6,676 KB
testcase_31 AC 275 ms
6,676 KB
testcase_32 AC 280 ms
6,676 KB
testcase_33 AC 282 ms
6,676 KB
testcase_34 AC 274 ms
6,676 KB
testcase_35 AC 282 ms
6,676 KB
testcase_36 AC 287 ms
6,676 KB
testcase_37 AC 290 ms
6,676 KB
testcase_38 AC 292 ms
6,676 KB
testcase_39 AC 223 ms
6,676 KB
testcase_40 AC 289 ms
6,676 KB
testcase_41 AC 290 ms
6,676 KB
testcase_42 AC 285 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(N);
    for( int x = 1; x <= 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