0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-08 13:58:48 +00:00

#2363. 「NOIP2016」愤怒的小鸟

https://loj.ac/s/1484345
This commit is contained in:
Baoshuo Ren 2022-06-16 11:21:23 +08:00
parent 23c99fc0de
commit a264986cce
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
41 changed files with 189 additions and 0 deletions

69
LibreOJ/2363/2363.cpp Normal file
View File

@ -0,0 +1,69 @@
#include <iostream>
#include <cstring>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 20;
const double eps = 1e-6;
int t, n, m, cnt, f[1 << N], s[N << 4];
std::pair<double, double> points[N];
inline std::pair<double, double> e(const std::pair<double, double> &_a, const std::pair<double, double> &_b) {
return std::make_pair(
(_a.second - _b.second * _a.first / _b.first) / (_a.first * (_a.first - _b.first)),
(_a.second - _b.second * _a.first * _a.first / (_b.first * _b.first)) / (_a.first - _a.first * _a.first / _b.first));
}
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> t;
while (t--) {
cnt = 0;
memset(f, 0x3f, sizeof(f));
memset(s, 0x00, sizeof(s));
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> points[i].first >> points[i].second;
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (std::abs(points[i].first - points[j].first) < eps) continue;
auto r = e(points[i], points[j]);
if (r.first > -eps) continue;
cnt++;
for (int k = 0; k < n; k++) {
if (std::abs(r.first * points[k].first * points[k].first + r.second * points[k].first - points[k].second) < eps) {
s[cnt] |= 1 << k;
}
}
}
}
f[0] = 0;
for (int i = 0; i < 1 << n; i++) {
// 两只及以上
for (int j = 1; j <= cnt; j++) {
f[i | s[j]] = std::min(f[i | s[j]], f[i] + 1);
}
// 一只
for (int j = 0; j < n; j++) {
f[i | 1 << j] = std::min(f[i | 1 << j], f[i] + 1);
}
}
cout << f[(1 << n) - 1] << endl;
}
return 0;
}

BIN
LibreOJ/2363/data/angrybirds1.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds10.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds11.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds11.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds12.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds12.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds13.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds13.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds14.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds14.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds15.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds15.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds16.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds16.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds17.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds17.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds18.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds18.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds19.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds19.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds2.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds20.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds20.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds3.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds4.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds5.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds6.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds7.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds8.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds9.ans (Stored with Git LFS) Normal file

Binary file not shown.

BIN
LibreOJ/2363/data/angrybirds9.in (Stored with Git LFS) Normal file

Binary file not shown.