結果
| 問題 |
No.2221 Set X
|
| コンテスト | |
| ユーザー |
hitonanode
|
| 提出日時 | 2023-02-17 23:26:57 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 104 ms / 2,000 ms |
| コード長 | 557 bytes |
| コンパイル時間 | 849 ms |
| コンパイル使用メモリ | 94,948 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 14:39:09 |
| 合計ジャッジ時間 | 3,839 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
cin.tie(nullptr), ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> A(N);
for (auto &x : A) cin >> x;
int best = 2 * N;
int argbest = 1;
for (int x = 2; x < N * 2; ++x) {
int cnt = 0;
for (int i = 0; i < N and cnt < best; i = lower_bound(begin(A) + i, end(A), A[i] / x * x + x) - begin(A)) cnt += x + 1;
if (best > cnt) best = cnt, argbest = x;
}
cout << argbest << '\n' << best << '\n';
}
hitonanode