mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-09 16:58:48 +00:00
parent
0e8181469d
commit
c1cc18c159
37
LibreOJ/2423/2423.cpp
Normal file
37
LibreOJ/2423/2423.cpp
Normal 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
BIN
LibreOJ/2423/data/stone9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user