QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#125191#4967. Square Fishing NetAH_LushoWA 1ms3448kbC++141.7kb2023-07-16 04:45:282023-07-16 04:45:29

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-16 04:45:29]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3448kb
  • [2023-07-16 04:45:28]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;


int main() {
    int n,s,x,y,res=0;
    cin>>s>>n;
    vector<pair<int,int> >v;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        v.push_back(make_pair(x,y));
    }
    for(int i=0;i<n;i++){
        int x1 = v[i].first, y1 = v[i].second, con=0;
        int x2 = x1+s, y2 = y1+s;
        for(int j=0;j<n;j++){

            x = v[j].first;
            y = v[j].second;
            if(x>=x1 and x<=x2 and y>=y1 and y<=y2){
                //cout<<x1<< ' '<<y1<<' '<<x2<<' ' <<y2<<' ' <<x<<' ' <<y<<endl;
                con++;
            }
        }
        res=max(con,res);
        con = 0;
        if(x1-s>0 and y1-s>0){
            x2 = x1-s; y2 = y1-s;
            for(int j=0;j<n;j++){

                x = v[j].first;
                y = v[j].second;
                if(x>=x2 and x<=x1 and y>=y2 and y<=y1){
                    con++;
                }
            }
        }
        res=max(con,res);
        con = 0;
        if(x1-s>0){
            x2 = x1-s; y2 = y1+s;
            for(int j=0;j<n;j++){

                x = v[j].first;
                y = v[j].second;
                if(x>=x2 and x<=x1 and y>=y2 and y<=y1){
                    con++;
                }
            }
        }
        res=max(con,res);
        con = 0;
        if(y1-s>0){
            x2 = x1+s; y2 = y1-s;
            for(int j=0;j<n;j++){

                x = v[j].first;
                y = v[j].second;
                if(x>=x2 and x<=x1 and y>=y2 and y<=y1){
                    con++;
                }
            }
        }
        res=max(con,res);
    }
    cout<<res<<endl;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3380kb

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: 3384kb

input:

50 2
10 5
11 5

output:

2

result:

ok single line: '2'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3448kb

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: 3440kb

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: 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: 3384kb

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: 0ms
memory: 3404kb

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: 3420kb

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: 3384kb

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: -100
Wrong Answer
time: 1ms
memory: 3360kb

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:

9

result:

wrong answer 1st lines differ - expected: '11', found: '9'