[
板情報
|
カテゴリランキング
]
したらばTOP
■掲示板に戻る■
全部
1-100
最新50
|
メール
|
1-
101-
201-
301-
401-
501-
601-
701-
801-
901-
1001-
1101-
1201-
1301-
1401-
1501-
1601-
1701-
1801-
1901-
2001-
2101-
2201-
2301-
2401-
2501-
2601-
2701-
2801-
2901-
3001-
3101-
3201-
3301-
3401-
3501-
3601-
3701-
3801-
3901-
4001-
4101-
4201-
4301-
4401-
4501-
4601-
4701-
4801-
4901-
5001-
5101-
5201-
5301-
5401-
この機能を使うにはJavaScriptを有効にしてください
|
管理人の独り言(プログラミング関連)
1533
:
◆adhRKFl5jU
:2009/03/01(日) 18:44:49
jid37
問題番号 10
点数 100
-----
/*
TASK: Cheating
LANG: C++
NAME: Kazuhiro Hosaka JPN13
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <bitset>
#include <complex>
using namespace std;
typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair
template<class T> void pv(T a, T b) { for (T i=a; i!=b; ++i) cout << *i << " "; cout << endl; }
template<class T> void pvp(T a, T b) { for (T i=a; i!=b; ++i) cout << "(" << i->first << ", " << i->second << ") "; cout << endl; }
int N,M;
int X[100010],Y[100010];
int need(int a[], int d) {
int i,ret=0;
int tmp=-d-1;
for (i=0; i<M; ++i) {
if (tmp < a[i]) {
tmp = a[i] + d;
++ret;
}
}
return ret;
}
int main() {
//freopen("cheating.in", "r", stdin);
int i;
scanf("%i%i", &N, &M);
for (i=0; i<M; ++i) {
scanf("%i%i", &X[i], &Y[i]);
}
sort(X, X+M);
sort(Y, Y+M);
int s=-1,e=1000000000;
for (int h; h=(s+e)/2, e-s>1; ) {
(need(X, h) + need(Y, h) > N) ? s = h : e = h;
}
printf("%i\n", e);
return 0;
}
新着レスの表示
名前:
E-mail
(省略可)
:
※書き込む際の注意事項は
こちら
※画像アップローダーは
こちら
(画像を表示できるのは「画像リンクのサムネイル表示」がオンの掲示板に限ります)
スマートフォン版
掲示板管理者へ連絡
無料レンタル掲示板