Submission #545530

# Submission time Handle Problem Language Result Execution time Memory
545530 2022-04-04T18:34:24 Z Dan13llljws IOI Fever (JOI21_fever) C++14
37 / 100
281 ms 596 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int read(){int s=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){s=(s<<3)+(s<<1)+ch-'0',ch=getchar();}return s*f;}
#define re read()
const int mod = 1e9 + 7, MM = 3005;
int n, ans, x[MM], y[MM], dir[MM], vis[MM], d[MM];
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int solve(int i, int di, int j, int dj){
    if (dx[dj] == dx[di]){
        if (x[i] != x[j] || (y[i] - y[j]) % (dy[dj] - dy[di])) return -1;
        return (y[i] - y[j]) / (dy[dj] - dy[di]);
    } else if (dy[dj] == dy[di]){
        if (y[i] != y[j] || (x[i] - x[j]) % (dx[dj] - dx[di])) return -1;
        return (x[i] - x[j]) / (dx[dj] - dx[di]);
    } else {
        int t = (x[i] - x[j]) / (dx[dj] - dx[di]), s = (y[i] - y[j]) / (dy[dj] - dy[di]);
        return t == s ? t : -1;
    }
}
int main(){
    n = re;
    for (int i = 1; i <= n; i++) x[i] = re, y[i] = re;
    for (int i = 2; i <= n; i++) x[i] -= x[1], y[i] -= y[1], x[i] <<= 1, y[i] <<= 1;
    x[1] = y[1] = 0;
    for (int d1 = 0; d1 < 4; d1++){
        memset(d, 0x3f, sizeof d), memset(vis, 0, sizeof vis);
        for (int i = 1; i <= n; i++){
            if (abs(y[i]) < x[i]) dir[i] = 2;
            else if (abs(y[i]) <= -x[i]) dir[i] = 0;
            else if (abs(x[i]) <= y[i]) dir[i] = 3;
            else if (abs(x[i]) <= -y[i]) dir[i] = 1;
        } int cur = 0; d[1] = 0;
        for (int i = 1; i <= n; i++){
            int u = -1, mint = 0x3f3f3f3f;
            for (int j = 1; j <= n; j++)
                if (!vis[j] && d[j] < mint) mint = d[j], u = j;
            if (u == -1) break;
            vis[u] = 1, cur++;
            for (int v = 1; v <= n; v++)
                if (!vis[v]){
                    if (dir[v] == dir[u]) continue;
                    int t = solve(u, dir[u], v, dir[v]);
                    if (t >= mint) d[v] = min(d[v], t);
                }
        } ans = max(ans, cur);
        for (int i = 2; i <= n; i++){
            int tx = x[i], ty = -y[i];
            x[i] = ty, y[i] = tx;
        }
    } printf("%d\n", ans);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 340 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 304 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 340 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 304 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 308 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 0 ms 340 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 1 ms 304 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 304 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 340 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 304 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 308 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 0 ms 340 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 1 ms 304 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 304 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 308 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 0 ms 212 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 0 ms 212 KB Output is correct
50 Correct 0 ms 212 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 1 ms 316 KB Output is correct
54 Correct 0 ms 340 KB Output is correct
55 Correct 1 ms 212 KB Output is correct
56 Correct 1 ms 300 KB Output is correct
57 Correct 1 ms 340 KB Output is correct
58 Correct 1 ms 340 KB Output is correct
59 Correct 1 ms 304 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 1 ms 340 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 340 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 304 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 308 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 0 ms 340 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 1 ms 304 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 304 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 308 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 0 ms 212 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 0 ms 212 KB Output is correct
50 Correct 0 ms 212 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 1 ms 316 KB Output is correct
54 Correct 0 ms 340 KB Output is correct
55 Correct 1 ms 212 KB Output is correct
56 Correct 1 ms 300 KB Output is correct
57 Correct 1 ms 340 KB Output is correct
58 Correct 1 ms 340 KB Output is correct
59 Correct 1 ms 304 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 1 ms 340 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 1 ms 312 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 2 ms 340 KB Output is correct
69 Correct 281 ms 352 KB Output is correct
70 Correct 109 ms 340 KB Output is correct
71 Correct 28 ms 340 KB Output is correct
72 Correct 1 ms 340 KB Output is correct
73 Correct 1 ms 340 KB Output is correct
74 Correct 84 ms 340 KB Output is correct
75 Correct 208 ms 400 KB Output is correct
76 Correct 48 ms 380 KB Output is correct
77 Correct 35 ms 340 KB Output is correct
78 Correct 39 ms 340 KB Output is correct
79 Correct 49 ms 396 KB Output is correct
80 Correct 8 ms 340 KB Output is correct
81 Correct 50 ms 396 KB Output is correct
82 Correct 89 ms 340 KB Output is correct
83 Correct 104 ms 400 KB Output is correct
84 Correct 11 ms 404 KB Output is correct
85 Correct 10 ms 340 KB Output is correct
86 Correct 52 ms 340 KB Output is correct
87 Correct 6 ms 408 KB Output is correct
88 Correct 36 ms 404 KB Output is correct
89 Correct 81 ms 340 KB Output is correct
90 Correct 86 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 340 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 304 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 308 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 0 ms 340 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 1 ms 304 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 304 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 308 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 0 ms 212 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 0 ms 212 KB Output is correct
50 Correct 0 ms 212 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 1 ms 316 KB Output is correct
54 Correct 0 ms 340 KB Output is correct
55 Correct 1 ms 212 KB Output is correct
56 Correct 1 ms 300 KB Output is correct
57 Correct 1 ms 340 KB Output is correct
58 Correct 1 ms 340 KB Output is correct
59 Correct 1 ms 304 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 1 ms 340 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Runtime error 2 ms 596 KB Execution killed with signal 11
67 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 340 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 304 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 308 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 0 ms 340 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 1 ms 304 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 304 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 308 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 0 ms 212 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 0 ms 212 KB Output is correct
50 Correct 0 ms 212 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 1 ms 316 KB Output is correct
54 Correct 0 ms 340 KB Output is correct
55 Correct 1 ms 212 KB Output is correct
56 Correct 1 ms 300 KB Output is correct
57 Correct 1 ms 340 KB Output is correct
58 Correct 1 ms 340 KB Output is correct
59 Correct 1 ms 304 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 1 ms 340 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 1 ms 312 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 2 ms 340 KB Output is correct
69 Correct 281 ms 352 KB Output is correct
70 Correct 109 ms 340 KB Output is correct
71 Correct 28 ms 340 KB Output is correct
72 Correct 1 ms 340 KB Output is correct
73 Correct 1 ms 340 KB Output is correct
74 Correct 84 ms 340 KB Output is correct
75 Correct 208 ms 400 KB Output is correct
76 Correct 48 ms 380 KB Output is correct
77 Correct 35 ms 340 KB Output is correct
78 Correct 39 ms 340 KB Output is correct
79 Correct 49 ms 396 KB Output is correct
80 Correct 8 ms 340 KB Output is correct
81 Correct 50 ms 396 KB Output is correct
82 Correct 89 ms 340 KB Output is correct
83 Correct 104 ms 400 KB Output is correct
84 Correct 11 ms 404 KB Output is correct
85 Correct 10 ms 340 KB Output is correct
86 Correct 52 ms 340 KB Output is correct
87 Correct 6 ms 408 KB Output is correct
88 Correct 36 ms 404 KB Output is correct
89 Correct 81 ms 340 KB Output is correct
90 Correct 86 ms 460 KB Output is correct
91 Runtime error 2 ms 596 KB Execution killed with signal 11
92 Halted 0 ms 0 KB -