제출 #1130285

#제출 시각아이디문제언어결과실행 시간메모리
1130285bliss08고기잡이 (KOI13_fish)C++20
16 / 16
49 ms416 KiB
#include <bits/stdc++.h> #define pii pair<int, int> #define x first #define y second using namespace std; int N, L, M, ans = INT_MIN; vector<pii> V; void find_fish(int sx, int sy, int ex, int ey) { int cnt = 0; for (int i = 0; i < M; i++) { if (V[i].x >= sx && V[i].x <= ex && V[i].y >= sy && V[i].y <= ey) cnt++; } ans = max(ans, cnt); } void rotate(int idx, int left, int right) { pii pre = V[idx]; for (int i = 0; i < left; i++) { pre.x -= 1; find_fish(pre.x, pre.y, pre.x + left, pre.y + right); } for (int i = 0; i < right; i++) { pre.y -= 1; find_fish(pre.x, pre.y, pre.x + left, pre.y + right); } for (int i = 0; i < left; i++) { pre.x += 1; find_fish(pre.x, pre.y, pre.x + left, pre.y + right); } for (int i = 0; i < right; i++) { pre.y += 1; find_fish(pre.x, pre.y, pre.x + left, pre.y + right); } } int main() { cin >> N >> L >> M; V.resize(M); for (auto& iv : V) cin >> iv.x >> iv.y; for (int i = 0; i < M; i++) // 물고기 잡힘 { for (int le = 1; le < L >> 1; le++) // 그물 정함 { int ri = (L >> 1) - le; rotate(i, le, ri); } } cout << ans; }
#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...