結果

問題 No.2221 Set X
ユーザー no wayno way
提出日時 2023-02-18 13:49:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 519 bytes
コンパイル時間 1,472 ms
コンパイル使用メモリ 164,456 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-27 06:31:43
合計ジャッジ時間 7,525 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 57 ms
4,376 KB
testcase_17 AC 21 ms
4,376 KB
testcase_18 AC 66 ms
4,380 KB
testcase_19 AC 19 ms
4,380 KB
testcase_20 AC 38 ms
4,376 KB
testcase_21 AC 54 ms
4,376 KB
testcase_22 AC 70 ms
4,376 KB
testcase_23 AC 5 ms
4,380 KB
testcase_24 AC 49 ms
4,376 KB
testcase_25 AC 30 ms
4,380 KB
testcase_26 AC 125 ms
4,380 KB
testcase_27 AC 154 ms
4,376 KB
testcase_28 AC 153 ms
4,380 KB
testcase_29 AC 99 ms
4,380 KB
testcase_30 AC 116 ms
4,380 KB
testcase_31 AC 145 ms
4,384 KB
testcase_32 AC 89 ms
4,376 KB
testcase_33 AC 95 ms
4,380 KB
testcase_34 AC 89 ms
4,380 KB
testcase_35 AC 86 ms
4,376 KB
testcase_36 AC 101 ms
4,380 KB
testcase_37 AC 109 ms
4,376 KB
testcase_38 AC 103 ms
4,380 KB
testcase_39 AC 123 ms
4,376 KB
testcase_40 AC 140 ms
4,380 KB
testcase_41 AC 122 ms
4,376 KB
testcase_42 AC 123 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,p,lim;
int a[N];
void s(int l,int r){
	if (l>r) return;
	int mid=(l+r)/2;
	if (a[mid]<lim) p=mid,s(mid+1,r); else s(l,mid-1);
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	int ans=2*n,q=1;
	for (int i=2;i<2*n;i++){
		int pos=1,t=0;
		while (pos<=n&&t*(i+1)<ans){
			lim=(a[pos]/i+1)*i;
			p=0; s(1,n);
			t++; pos=p+1;
		}
		if (pos>n&&ans>t*(i+1)) ans=min(ans,t*(i+1)),q=i;
	}
	printf("%d\n",q);
	printf("%d\n",ans);
}
0