Tue, 12 Mar 2019 21:39:13 GMT

master
大蒟蒻 7 years ago
parent c7ccfea1ae
commit 64a29eb2b4

@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 17)
if(MSVC)
add_compile_options("/Zc:__cplusplus")
endif()
add_executable(P1 P1.cpp)
add_executable(P2 P2.cpp)
add_executable(P3 P3.cpp)
add_executable(P4 P4.cpp)
add_executable(P5 P5.cpp)

@ -0,0 +1,20 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, x;
map<int, multiset<int>> A, B;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
scanf("%d", &x), A[i + j].insert(x);
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
scanf("%d", &x), B[i + j].insert(x);
puts(A == B ? "YES" : "NO");
return 0;
}

@ -0,0 +1,28 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
vector<int> p(n);
for (auto &x:p) cin >> x;
vector<pair<int, int>> canswap(m);
for (auto &x:canswap) cin >> x.first >> x.second;
set<pair<int, int>> S(canswap.begin(), canswap.end());
int targetval = *p.rbegin();
for (int i = n - 1; i; i--)
if (S.count(make_pair(p[i - 1], p[i]))) {
swap(p[i - 1], p[i]);
for (int j = i + 1; j < n; j++)
if (S.count(make_pair(p[j - 1], p[j])))
swap(p[j - 1], p[j]);
else break;
}
cout << distance(p.rbegin(), find(p.rbegin(), p.rend(), targetval));
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
return 0;
}

@ -0,0 +1,46 @@
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
int main() {
int n;
while (scanf("%d", &n), n) {
pair<int, int> ps[20];
auto dis = [&](int p, int q) {
return sqrt((ps[p].first - ps[q].first) * (ps[p].first - ps[q].first) +
(ps[p].second - ps[q].second) * (ps[p].second - ps[q].second));
};
for (int i = 0; i < n; i++)
scanf("%d%d", &ps[i].first, &ps[i].second);
sort(ps, ps + n);
if(n != unique(ps, ps + n) - ps)
return -1;
vector<tuple<int, int, int>> v;
for (int i = 0; i < n; i++)
for (int j = 0; j < i; j++)
for (int k = 0; k < j; k++) {
double arr[] = {dis(i, j), dis(j, k), dis(k, i)};
sort(begin(arr), end(arr));
for (int l = 2; l >= 0; l--)
arr[l] /= arr[0];
if (arr[0] + arr[1] > arr[2] + eps)
v.push_back(make_tuple(arr[0], arr[1], arr[2]));
}
int ans = 0;
for (const auto &p:v) {
int cnt = 0;
for (const auto &q:v) {
if (abs(get<1>(p) - get<1>(q)) > eps) continue;
if (abs(get<2>(p) - get<2>(q)) > eps) continue;
cnt++;
}
ans = max(ans, cnt);
}
cout << ans << endl;
}
return 0;
}
Loading…
Cancel
Save