0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-09 16:18:49 +00:00

#2423. 「NOIP2015」跳石头

https://loj.ac/s/1314081
This commit is contained in:
Baoshuo Ren 2021-12-01 20:54:34 +08:00
parent 0e8181469d
commit c1cc18c159
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68
21 changed files with 97 additions and 0 deletions

37
LibreOJ/2423/2423.cpp Normal file
View File

@ -0,0 +1,37 @@
#include <bits/stdc++.h>
using namespace std;
int n, m, l, r, mid, ans, a[50005];
bool check(int x) {
int now = 0, cnt = 0;
for (int i = 1; i <= n; i++) {
if (a[i] - a[now] < x) {
cnt++;
} else {
now = i;
}
}
return cnt <= m;
}
int main() {
cin >> r >> n >> m;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
a[n + 1] = r;
l = 1;
while (l <= r) {
mid = l + r >> 1;
if (check(mid)) {
ans = mid;
l = mid + 1;
} else {
r = mid - 1;
}
}
cout << ans << endl;
return 0;
}

BIN
LibreOJ/2423/data/stone1.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone10.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone2.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone3.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone4.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone5.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone6.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone7.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone8.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone9.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2423/data/stone9.in (Stored with Git LFS) Normal file

Binary file not shown.