QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#125185 | #4967. Square Fishing Net | lian | AC ✓ | 2ms | 3472kb | C++14 | 856b | 2023-07-16 04:15:15 | 2023-07-16 04:15:16 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
struct Point {
int x;
int y;
};
bool isInsideSquare(const Point& point, int side, int x, int y) {
return (point.x >= x && point.x <= x + side && point.y >= y && point.y <= y + side);
}
int main() {
int s, n;
cin >> s >> n;
vector<Point> fish(n);
for (int i = 0; i < n; i++) {
cin >> fish[i].x >> fish[i].y;
}
int maxFish = 0;
for (int x = 1; x <= 100 - s + 1; x++) {
for (int y = 1; y <= 100 - s + 1; y++) {
int fishCount = 0;
for (int i = 0; i < n; i++) {
if (isInsideSquare(fish[i], s, x, y)) {
fishCount++;
}
}
maxFish = max(maxFish, fishCount);
}
}
cout << maxFish << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3448kb
input:
3 8 2 1 2 3 5 1 5 2 3 2 4 2 10 5 11 5
output:
6
result:
ok single line: '6'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3440kb
input:
50 2 10 5 11 5
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3412kb
input:
2 9 100 100 99 99 98 98 98 99 99 98 98 100 100 98 99 100 100 99
output:
9
result:
ok single line: '9'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3444kb
input:
1 9 100 100 99 99 98 98 98 99 99 98 98 100 100 98 99 100 100 99
output:
4
result:
ok single line: '4'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3420kb
input:
1 6 1 100 2 99 76 45 43 89 1 99 2 100
output:
4
result:
ok single line: '4'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3368kb
input:
1 8 39 78 39 89 1 2 2 1 76 45 43 89 1 1 2 2
output:
4
result:
ok single line: '4'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3440kb
input:
1 8 100 2 39 78 39 89 99 1 76 45 100 1 43 89 99 2
output:
4
result:
ok single line: '4'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3440kb
input:
9 100 4 96 3 93 2 99 4 100 7 97 8 94 8 93 9 92 2 98 6 91 6 98 5 92 8 96 3 94 1 92 1 99 5 94 10 99 9 97 2 92 6 94 3 97 7 96 10 95 9 94 7 99 6 99 8 92 3 95 4 91 2 100 3 98 10 93 10 98 6 93 2 96 4 92 10 91 7 94 7 91 9 98 7 95 6 96 6 97 3 96 3 92 10 100 2 97 5 97 5 98 5 96 5 95 8 95 6 92 8 91 5 99 7 100...
output:
100
result:
ok single line: '100'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3420kb
input:
6 100 92 5 99 5 92 2 93 4 94 9 94 6 91 2 98 8 91 4 93 2 97 8 94 8 97 10 93 8 94 5 93 7 99 10 97 4 99 6 91 1 99 1 98 3 99 8 96 9 99 3 96 7 92 6 97 9 97 2 98 7 95 7 97 6 94 4 98 5 93 3 91 6 92 1 92 7 95 3 95 9 94 10 91 5 100 1 98 4 95 5 100 2 96 8 97 5 100 10 100 6 100 8 96 4 97 7 94 2 91 7 93 10 100 ...
output:
49
result:
ok single line: '49'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3388kb
input:
19 100 93 27 19 7 64 70 2 32 21 78 90 71 83 22 3 48 92 16 41 4 94 49 41 30 86 32 46 57 15 42 17 77 8 18 40 75 20 60 61 44 73 36 28 97 1 72 38 74 46 58 90 97 58 56 43 10 47 96 43 99 79 7 39 42 18 24 50 68 13 64 33 84 77 12 95 37 59 91 53 66 19 95 6 53 8 58 2 5 89 94 62 34 90 41 78 29 78 16 55 21 55 4...
output:
11
result:
ok single line: '11'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3452kb
input:
49 100 93 27 19 7 64 70 2 32 21 78 90 71 83 22 3 48 92 16 41 4 94 49 41 30 86 32 46 57 15 42 17 77 8 18 40 75 20 60 61 44 73 36 28 97 1 72 38 74 46 58 90 97 58 56 43 10 47 96 43 99 79 7 39 42 18 24 50 68 13 64 33 84 77 12 95 37 59 91 53 66 19 95 6 53 8 58 2 5 89 94 62 34 90 41 78 29 78 16 55 21 55 4...
output:
35
result:
ok single line: '35'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3380kb
input:
50 100 93 27 19 7 64 70 2 32 21 78 90 71 83 22 3 48 92 16 41 4 94 49 41 30 86 32 46 57 15 42 17 77 8 18 40 75 20 60 61 44 73 36 28 97 1 72 38 74 46 58 90 97 58 56 43 10 47 96 43 99 79 7 39 42 18 24 50 68 13 64 33 84 77 12 95 37 59 91 53 66 19 95 6 53 8 58 2 5 89 94 62 34 90 41 78 29 78 16 55 21 55 4...
output:
37
result:
ok single line: '37'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
98 100 100 94 88 100 7 100 100 4 11 1 10 100 7 1 1 11 1 97 2 100 89 100 1 93 12 1 90 1 100 9 100 93 100 91 1 4 94 100 1 7 100 100 100 92 100 88 93 100 97 100 1 91 100 98 96 100 9 1 91 1 1 2 99 1 96 1 1 90 93 1 9 100 1 99 12 100 1 100 98 1 1 8 100 7 1 13 1 3 5 1 13 100 4 100 95 1 6 100 1 5 100 13 100...
output:
49
result:
ok single line: '49'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3380kb
input:
99 100 100 94 88 100 7 100 100 4 11 1 10 100 7 1 1 11 1 97 2 100 89 100 1 93 12 1 90 1 100 9 100 93 100 91 1 4 94 100 1 7 100 100 100 92 100 88 93 100 97 100 1 91 100 98 96 100 9 1 91 1 1 2 99 1 96 1 1 90 93 1 9 100 1 99 12 100 1 100 98 1 1 8 100 7 1 13 1 3 5 1 13 100 4 100 95 1 6 100 1 5 100 13 100...
output:
100
result:
ok single line: '100'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3424kb
input:
86 100 100 94 88 100 7 100 100 4 11 1 10 100 7 1 1 11 1 97 2 100 89 100 1 93 12 1 90 1 100 9 100 93 100 91 1 4 94 100 1 7 100 100 100 92 100 88 93 100 97 100 1 91 100 98 96 100 9 1 91 1 1 2 99 1 96 1 1 90 93 1 9 100 1 99 12 100 1 100 98 1 1 8 100 7 1 13 1 3 5 1 13 100 4 100 95 1 6 100 1 5 100 13 100...
output:
25
result:
ok single line: '25'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
7 100 18 89 20 90 19 91 21 88 22 88 22 89 21 90 19 93 18 93 21 91 20 89 22 90 20 88 19 89 19 88 17 90 18 92 20 93 17 88 20 91 21 93 20 92 18 91 17 91 17 92 18 90 18 88 22 91 21 92 22 92 22 93 19 90 21 89 17 89 17 93 19 92 51 42 48 46 49 44 52 47 48 41 48 43 53 41 46 45 46 47 52 40 53 45 51 43 51 40 ...
output:
64
result:
ok single line: '64'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3472kb
input:
100 100 93 27 19 7 64 70 2 32 21 78 90 71 83 22 3 48 92 16 41 4 94 49 41 30 86 32 46 57 15 42 17 77 8 18 40 75 20 60 61 44 73 36 28 97 1 72 38 74 46 58 90 97 58 56 43 10 47 96 43 99 79 7 39 42 18 24 50 68 13 64 33 84 77 12 95 37 59 91 53 66 19 95 6 53 8 58 2 5 89 94 62 34 90 41 78 29 78 16 55 21 55 ...
output:
100
result:
ok single line: '100'