제출 #928575

#제출 시각아이디문제언어결과실행 시간메모리
928575denniskimIOI 바이러스 (JOI21_fever)C++17
25 / 100
5058 ms14024 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef __int128 lll; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<ld, ld> pld; #define MAX 9223372036854775807LL #define MIN -9223372036854775807LL #define INF 0x3f3f3f3f3f3f3f3f #define fi first #define se second #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout.precision(10); #define sp << " " #define en << "\n" #define compress(v) sort(v.begin(), v.end()), v.erase(unique(v.begin(), v.end()), v.end()) struct gujo { ll X, D1, Y, D2, T; bool operator < (const gujo &xx) const { return T < xx.T; } }; ll n; pll a[100010]; vector<gujo> vec; ll ans; ll D[100010]; ll solve(ll dir) { ll ret = 1; for(ll i = 1 ; i <= n ; i++) D[i] = -1; D[1] = dir; for(auto &i : vec) { if(D[i.X] != -1 && D[i.Y] != -1) continue; if(D[i.X] != -1) { if(D[i.X] == i.D1) D[i.Y] = i.D2, ret++; } else if(D[i.Y] != -1) { if(D[i.Y] == i.D2) D[i.X] = i.D1, ret++; } } return ret; } int main(void) { fastio cin >> n; for(ll i = 1 ; i <= n ; i++) cin >> a[i].fi >> a[i].se; for(ll i = 1 ; i <= n ; i++) { for(ll j = i + 1 ; j <= n ; j++) { if(a[i].fi == a[j].fi) { if(a[i].se < a[j].se) vec.push_back({i, 1, j, 3, (a[j].se - a[i].se)}); else vec.push_back({i, 3, j, 1, (a[i].se - a[j].se)}); } else if(a[i].se == a[j].se) { if(a[i].fi < a[j].fi) vec.push_back({i, 0, j, 2, a[j].fi - a[i].fi}); else vec.push_back({i, 2, j, 0, a[j].fi - a[i].fi}); } else if(a[i].fi + a[i].se == a[j].fi + a[j].se) { if(a[i].fi < a[j].fi) { vec.push_back({i, 1, j, 0, (a[j].fi - a[i].fi) * 2}); vec.push_back({i, 2, j, 3, (a[j].fi - a[i].fi) * 2}); } else { vec.push_back({i, 0, j, 1, (a[i].fi - a[j].fi) * 2}); vec.push_back({i, 3, j, 2, (a[i].fi - a[j].fi) * 2}); } } else if(a[i].fi - a[i].se == a[j].fi - a[j].se) { if(a[i].fi < a[j].fi) { vec.push_back({i, 0, j, 3, (a[j].fi - a[i].fi) * 2}); vec.push_back({i, 1, j, 2, (a[j].fi - a[i].fi) * 2}); } else { vec.push_back({i, 3, j, 0, (a[i].fi - a[j].fi) * 2}); vec.push_back({i, 2, j, 1, (a[i].fi - a[j].fi) * 2}); } } } } sort(vec.begin(), vec.end()); for(ll i = 0 ; i < 4 ; i++) ans = max(ans, solve(i)); cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...