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

#910. [2018.8长郡集训day1]都市

https://sjzezoj.com/submission/59281
This commit is contained in:
Baoshuo Ren 2022-10-03 16:57:45 +08:00
parent fc307c3348
commit b836ec30ab
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
26 changed files with 154 additions and 0 deletions

79
S2OJ/910/910.cpp Normal file
View File

@ -0,0 +1,79 @@
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <vector>
using std::cin;
using std::cout;
const char endl = '\n';
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
std::vector<int> a;
std::vector<std::vector<int>> ans;
cin >> n;
for (int i = 1, x; i <= n * (n - 1) / 2; i++) {
cin >> x;
a.emplace_back(x);
}
std::sort(a.begin(), a.end());
for (int i = a[0] >> 1; i; i--) {
int b = a[0] - i,
c = a[1] - i;
if (*std::lower_bound(a.begin(), a.end(), b + c) != b + c) continue;
std::vector<int> v;
std::unordered_map<int, int> map;
for (int x : a) map[x]++;
v.emplace_back(i);
map[i + b]--;
v.emplace_back(b);
map[i + c]--;
v.emplace_back(c);
map[b + c]--;
bool flag = false;
for (int j = 2; j < a.size() && !flag; j++) {
if (!map[a[j]]) continue;
for (int x : v) {
if (!map.count(x + a[j] - i) || !map[x + a[j] - i]) {
flag = true;
break;
}
map[x + a[j] - i]--;
}
v.emplace_back(a[j] - i);
}
if (!flag) ans.emplace_back(v);
}
cout << ans.size() << endl;
std::sort(ans.begin(), ans.end(), std::greater<>());
for (auto item : ans) {
for (int x : item) {
cout << x << ' ';
}
cout << endl;
}
return 0;
}

BIN
S2OJ/910/data/city1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/city9.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/ex_city1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/ex_city1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/ex_city2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/ex_city2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/910/data/problem.conf (Stored with Git LFS) Normal file

Binary file not shown.