結果

問題 No.180 美しいWhitespace (2)
ユーザー chocoruskchocorusk
提出日時 2018-10-11 19:07:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 427 ms / 5,000 ms
コード長 1,088 bytes
コンパイル時間 905 ms
コンパイル使用メモリ 82,912 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-02 19:37:27
合計ジャッジ時間 7,925 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 5 ms
4,384 KB
testcase_05 AC 14 ms
4,384 KB
testcase_06 AC 35 ms
4,380 KB
testcase_07 AC 59 ms
4,384 KB
testcase_08 AC 79 ms
4,384 KB
testcase_09 AC 411 ms
4,384 KB
testcase_10 AC 388 ms
4,380 KB
testcase_11 AC 245 ms
4,380 KB
testcase_12 AC 427 ms
4,380 KB
testcase_13 AC 426 ms
4,384 KB
testcase_14 AC 336 ms
4,384 KB
testcase_15 AC 262 ms
4,380 KB
testcase_16 AC 357 ms
4,384 KB
testcase_17 AC 388 ms
4,380 KB
testcase_18 AC 330 ms
4,384 KB
testcase_19 AC 292 ms
4,384 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,384 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,384 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,384 KB
testcase_28 AC 1 ms
4,384 KB
testcase_29 AC 1 ms
4,384 KB
testcase_30 AC 412 ms
4,380 KB
testcase_31 AC 408 ms
4,380 KB
testcase_32 AC 51 ms
4,380 KB
testcase_33 AC 255 ms
4,384 KB
testcase_34 AC 255 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	cin>>n;
	ll a[1000], b[1000];
	for(int i=0; i<n; i++) cin>>a[i]>>b[i];
	ll d1=0, d2=2e9;
	while(d1!=d2){
		ll d=(d1+d2)/2;
		ll xmn=1, xmx=1e18;
		bool nuee=0;
		for(int i=0; i<n; i++){
			for(int j=0; j<n; j++){
				if(i==j) continue;
				if(b[i]==b[j]){
					if(abs(a[i]-a[j])>d){
						nuee=1;
						break;
					}
				}else if(b[i]>b[j]){
					xmx=min(xmx, (d-a[i]+a[j])/(b[i]-b[j]));
				}else{
					xmn=max(xmn, (a[i]-a[j]-d+b[j]-b[i]-1)/(b[j]-b[i]));
				}
				if(xmn>xmx){
					nuee=1;
					break;
				}
			}
			if(nuee) break;
		}
		if(nuee) d1=d+1;
		else d2=d;
	}
	ll xmn=1;
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			if(b[i]<b[j]){
				xmn=max(xmn, (a[i]-a[j]-d1+b[j]-b[i]-1)/(b[j]-b[i]));
			}
		}
	}
	cout<<xmn<<endl;
	return 0;
}
0