QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#139408 | #4967. Square Fishing Net | artcs | AC ✓ | 2ms | 3700kb | C++17 | 913b | 2023-08-13 12:37:39 | 2023-08-13 12:37:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main()
{
int s, n, x,y;
cin>>s>>n;
int mat[105][105], cum[105][105];
memset(mat, 0,sizeof mat);
memset(cum, 0,sizeof cum);
for (int i=0;i<n;i++)
{
cin>>x>>y;
mat[y][x] = 1;
}
for(int i=1;i<105;i++)
for(int j=1;j<105;j++)
cum[i][j] = ( mat[i][j] + cum[i-1][j] + cum[i][j-1] - cum[i-1][j-1]);
int maxi = 0, val;
// for (int i=0; i<15; i++)
// {
// for (int j=0; j<15; j++)
// cout<<cum[i][j]<<" ";
// cout<<endl;
// }
//
s+=1;
for(int i=s;i<105;i++)
for(int j=s;j<105;j++)
{
val = cum[i][j] + cum[i-s][j-s] - cum[i-s][j] - cum[i][j-s];
maxi = max(maxi, val);
}
cout<<maxi<<endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3480kb
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: 1ms
memory: 3648kb
input:
50 2 10 5 11 5
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3532kb
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: 3416kb
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: 1ms
memory: 3528kb
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: 3536kb
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: 3536kb
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: 0ms
memory: 3696kb
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: 1ms
memory: 3488kb
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: 1ms
memory: 3476kb
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: 3700kb
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: 3412kb
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: 3484kb
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: 3484kb
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: 2ms
memory: 3492kb
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: 3528kb
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: 0ms
memory: 3516kb
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'