0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 17:36:27 +00:00

#10215. 「一本通 6.4 练习 1」荒岛野人

https://loj.ac/s/1472517
This commit is contained in:
Baoshuo Ren 2022-05-30 18:18:22 +08:00
parent 892d4c6881
commit f6e8e7b701
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
21 changed files with 131 additions and 0 deletions

71
LibreOJ/10215/10215.cpp Normal file
View File

@ -0,0 +1,71 @@
#include <algorithm>
#include <iostream>
#include <tuple>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 20;
int n, max, ans;
std::tuple<int, int, int> a[N];
int exgcd(int a, int b, int& x, int& y) {
if (!b) {
x = 1, y = 0;
return a;
}
int g = exgcd(b, a % b, y, x);
y -= a / b * x;
return g;
}
bool check(int k) {
for (int i = 1; i < n; i++) {
for (int j = i + 1; j <= n; j++) {
int c1, p1, l1, c2, p2, l2;
std::tie(c1, p1, l1) = a[i];
std::tie(c2, p2, l2) = a[j];
int a = p1 - p2,
b = k,
c = c2 - c1;
int x, y,
g = exgcd(a, b, x, y);
if (c % g) continue;
a /= g, b = std::abs(b / g), c /= g;
x = (x * c % b + b) % b;
if (x <= std::min(l1, l2)) return false;
}
}
return true;
}
int main() {
std::ios::sync_with_stdio(false);
cin >> n;
for (int i = 1, c, p, l; i <= n; i++) {
cin >> std::get<0>(a[i]) >> std::get<1>(a[i]) >> std::get<2>(a[i]);
max = std::max(max, std::get<0>(a[i]));
}
for (int i = max; i <= 1000000; i++) {
if (check(i)) {
cout << i << endl;
exit(0);
}
}
return 0;
}

BIN
LibreOJ/10215/data/savage1.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage10.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage2.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage3.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage4.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage5.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage6.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage7.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage8.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage9.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/10215/data/savage9.in (Stored with Git LFS) Normal file

Binary file not shown.