Submission #949072

# Submission time Handle Problem Language Result Execution time Memory
949072 2024-03-18T22:58:53 Z MilosMilutinovic IOI Fever (JOI21_fever) C++14
37 / 100
5000 ms 51584 KB
#include<bits/stdc++.h>
 
#define pb push_back
#define fi first
#define se second
#define mp make_pair
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
 
template <typename T> bool chkmin(T &x,T y){return x>y?x=y,1:0;}
template <typename T> bool chkmax(T &x,T y){return x<y?x=y,1:0;}
 
ll readint(){
    ll x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
 
const int dx[]={1,0,-1,0};
const int dy[]={0,1,0,-1};
int n;
ll x[100005],y[100005],dir[100005];
bool was[100005],seen[100005];
 
int main(){
	n=readint();
	for(int i=1;i<=n;i++) x[i]=readint(),y[i]=readint(),x[i]*=2,y[i]*=2;
	int ans=0;
	for(int d=0;d<4;d++){
		for(int i=1;i<=n;i++) was[i]=seen[i]=false;
		dir[1]=d;
		was[1]=true;
		priority_queue<pair<ll,int>> pq;
		pq.push(mp(0,1));
		while(!pq.empty()){
			ll t=-pq.top().first;
			int i=pq.top().second;
			pq.pop();
			if(seen[i]) continue;
			seen[i]=true;
			for(int j=1;j<=n;j++){
				if(i==j) continue;
				for(int dd=0;dd<4;dd++){
					if(dir[i]==dd) continue;
					ll cx=dx[dir[i]]-dx[dd];
					ll cy=dy[dir[i]]-dy[dd];
					if((x[j]-x[i])*cy!=(y[j]-y[i])*cx) continue;
					ll ct=(cx==0?(y[j]-y[i])/cy:(x[j]-x[i])/cx);
					if(x[i]+ct*dx[dir[i]]!=x[j]+ct*dx[dd]) continue;
					if(y[i]+ct*dy[dir[i]]!=y[j]+ct*dy[dd]) continue;
					if(ct<t) continue;
					dir[j]=dd;
					was[j]=true;
					pq.push(mp(-ct,j));				
				}
			}
		}
		int cnt=0;
		for(int i=1;i<=n;i++) cnt+=was[i];
		ans=max(ans,cnt);
	}
	printf("%d\n",ans);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2492 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2492 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2392 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2392 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 1 ms 2496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2492 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2492 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2392 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2392 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 1 ms 2496 KB Output is correct
33 Correct 1 ms 2392 KB Output is correct
34 Correct 1 ms 2556 KB Output is correct
35 Correct 1 ms 2648 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2396 KB Output is correct
38 Correct 0 ms 2396 KB Output is correct
39 Correct 1 ms 2396 KB Output is correct
40 Correct 1 ms 2396 KB Output is correct
41 Correct 1 ms 2392 KB Output is correct
42 Correct 1 ms 2396 KB Output is correct
43 Correct 1 ms 2396 KB Output is correct
44 Correct 0 ms 2396 KB Output is correct
45 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2492 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2492 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2392 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2392 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 1 ms 2496 KB Output is correct
33 Correct 1 ms 2392 KB Output is correct
34 Correct 1 ms 2556 KB Output is correct
35 Correct 1 ms 2648 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2396 KB Output is correct
38 Correct 0 ms 2396 KB Output is correct
39 Correct 1 ms 2396 KB Output is correct
40 Correct 1 ms 2396 KB Output is correct
41 Correct 1 ms 2392 KB Output is correct
42 Correct 1 ms 2396 KB Output is correct
43 Correct 1 ms 2396 KB Output is correct
44 Correct 0 ms 2396 KB Output is correct
45 Correct 1 ms 2396 KB Output is correct
46 Correct 1 ms 2396 KB Output is correct
47 Correct 1 ms 2396 KB Output is correct
48 Correct 1 ms 2396 KB Output is correct
49 Correct 1 ms 2392 KB Output is correct
50 Correct 1 ms 2396 KB Output is correct
51 Correct 1 ms 2396 KB Output is correct
52 Correct 1 ms 2396 KB Output is correct
53 Correct 1 ms 2396 KB Output is correct
54 Correct 1 ms 2648 KB Output is correct
55 Correct 1 ms 2392 KB Output is correct
56 Correct 1 ms 2392 KB Output is correct
57 Correct 1 ms 2396 KB Output is correct
58 Correct 3 ms 2564 KB Output is correct
59 Correct 1 ms 2396 KB Output is correct
60 Correct 1 ms 2396 KB Output is correct
61 Correct 1 ms 2396 KB Output is correct
62 Correct 1 ms 2392 KB Output is correct
63 Correct 1 ms 2396 KB Output is correct
64 Correct 1 ms 2392 KB Output is correct
65 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2492 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2492 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2392 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2392 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 1 ms 2496 KB Output is correct
33 Correct 1 ms 2392 KB Output is correct
34 Correct 1 ms 2556 KB Output is correct
35 Correct 1 ms 2648 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2396 KB Output is correct
38 Correct 0 ms 2396 KB Output is correct
39 Correct 1 ms 2396 KB Output is correct
40 Correct 1 ms 2396 KB Output is correct
41 Correct 1 ms 2392 KB Output is correct
42 Correct 1 ms 2396 KB Output is correct
43 Correct 1 ms 2396 KB Output is correct
44 Correct 0 ms 2396 KB Output is correct
45 Correct 1 ms 2396 KB Output is correct
46 Correct 1 ms 2396 KB Output is correct
47 Correct 1 ms 2396 KB Output is correct
48 Correct 1 ms 2396 KB Output is correct
49 Correct 1 ms 2392 KB Output is correct
50 Correct 1 ms 2396 KB Output is correct
51 Correct 1 ms 2396 KB Output is correct
52 Correct 1 ms 2396 KB Output is correct
53 Correct 1 ms 2396 KB Output is correct
54 Correct 1 ms 2648 KB Output is correct
55 Correct 1 ms 2392 KB Output is correct
56 Correct 1 ms 2392 KB Output is correct
57 Correct 1 ms 2396 KB Output is correct
58 Correct 3 ms 2564 KB Output is correct
59 Correct 1 ms 2396 KB Output is correct
60 Correct 1 ms 2396 KB Output is correct
61 Correct 1 ms 2396 KB Output is correct
62 Correct 1 ms 2392 KB Output is correct
63 Correct 1 ms 2396 KB Output is correct
64 Correct 1 ms 2392 KB Output is correct
65 Correct 1 ms 2396 KB Output is correct
66 Correct 2 ms 2504 KB Output is correct
67 Correct 1 ms 2500 KB Output is correct
68 Correct 1 ms 2396 KB Output is correct
69 Correct 322 ms 3632 KB Output is correct
70 Correct 113 ms 2624 KB Output is correct
71 Correct 28 ms 2392 KB Output is correct
72 Correct 1 ms 2396 KB Output is correct
73 Correct 1 ms 2396 KB Output is correct
74 Correct 182 ms 2620 KB Output is correct
75 Correct 1301 ms 28848 KB Output is correct
76 Correct 58 ms 3032 KB Output is correct
77 Correct 45 ms 2944 KB Output is correct
78 Correct 33 ms 2396 KB Output is correct
79 Correct 40 ms 2396 KB Output is correct
80 Correct 6 ms 2396 KB Output is correct
81 Correct 46 ms 2396 KB Output is correct
82 Correct 368 ms 15036 KB Output is correct
83 Correct 1252 ms 51584 KB Output is correct
84 Correct 48 ms 2396 KB Output is correct
85 Correct 13 ms 2544 KB Output is correct
86 Correct 43 ms 2552 KB Output is correct
87 Correct 20 ms 2392 KB Output is correct
88 Correct 232 ms 2652 KB Output is correct
89 Correct 72 ms 2536 KB Output is correct
90 Correct 75 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2492 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2492 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2392 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2392 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 1 ms 2496 KB Output is correct
33 Correct 1 ms 2392 KB Output is correct
34 Correct 1 ms 2556 KB Output is correct
35 Correct 1 ms 2648 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2396 KB Output is correct
38 Correct 0 ms 2396 KB Output is correct
39 Correct 1 ms 2396 KB Output is correct
40 Correct 1 ms 2396 KB Output is correct
41 Correct 1 ms 2392 KB Output is correct
42 Correct 1 ms 2396 KB Output is correct
43 Correct 1 ms 2396 KB Output is correct
44 Correct 0 ms 2396 KB Output is correct
45 Correct 1 ms 2396 KB Output is correct
46 Correct 1 ms 2396 KB Output is correct
47 Correct 1 ms 2396 KB Output is correct
48 Correct 1 ms 2396 KB Output is correct
49 Correct 1 ms 2392 KB Output is correct
50 Correct 1 ms 2396 KB Output is correct
51 Correct 1 ms 2396 KB Output is correct
52 Correct 1 ms 2396 KB Output is correct
53 Correct 1 ms 2396 KB Output is correct
54 Correct 1 ms 2648 KB Output is correct
55 Correct 1 ms 2392 KB Output is correct
56 Correct 1 ms 2392 KB Output is correct
57 Correct 1 ms 2396 KB Output is correct
58 Correct 3 ms 2564 KB Output is correct
59 Correct 1 ms 2396 KB Output is correct
60 Correct 1 ms 2396 KB Output is correct
61 Correct 1 ms 2396 KB Output is correct
62 Correct 1 ms 2392 KB Output is correct
63 Correct 1 ms 2396 KB Output is correct
64 Correct 1 ms 2392 KB Output is correct
65 Correct 1 ms 2396 KB Output is correct
66 Correct 8 ms 3672 KB Output is correct
67 Correct 13 ms 3928 KB Output is correct
68 Correct 11 ms 4700 KB Output is correct
69 Execution timed out 5024 ms 6096 KB Time limit exceeded
70 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2492 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2492 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 1 ms 2392 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2392 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 1 ms 2496 KB Output is correct
33 Correct 1 ms 2392 KB Output is correct
34 Correct 1 ms 2556 KB Output is correct
35 Correct 1 ms 2648 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2396 KB Output is correct
38 Correct 0 ms 2396 KB Output is correct
39 Correct 1 ms 2396 KB Output is correct
40 Correct 1 ms 2396 KB Output is correct
41 Correct 1 ms 2392 KB Output is correct
42 Correct 1 ms 2396 KB Output is correct
43 Correct 1 ms 2396 KB Output is correct
44 Correct 0 ms 2396 KB Output is correct
45 Correct 1 ms 2396 KB Output is correct
46 Correct 1 ms 2396 KB Output is correct
47 Correct 1 ms 2396 KB Output is correct
48 Correct 1 ms 2396 KB Output is correct
49 Correct 1 ms 2392 KB Output is correct
50 Correct 1 ms 2396 KB Output is correct
51 Correct 1 ms 2396 KB Output is correct
52 Correct 1 ms 2396 KB Output is correct
53 Correct 1 ms 2396 KB Output is correct
54 Correct 1 ms 2648 KB Output is correct
55 Correct 1 ms 2392 KB Output is correct
56 Correct 1 ms 2392 KB Output is correct
57 Correct 1 ms 2396 KB Output is correct
58 Correct 3 ms 2564 KB Output is correct
59 Correct 1 ms 2396 KB Output is correct
60 Correct 1 ms 2396 KB Output is correct
61 Correct 1 ms 2396 KB Output is correct
62 Correct 1 ms 2392 KB Output is correct
63 Correct 1 ms 2396 KB Output is correct
64 Correct 1 ms 2392 KB Output is correct
65 Correct 1 ms 2396 KB Output is correct
66 Correct 2 ms 2504 KB Output is correct
67 Correct 1 ms 2500 KB Output is correct
68 Correct 1 ms 2396 KB Output is correct
69 Correct 322 ms 3632 KB Output is correct
70 Correct 113 ms 2624 KB Output is correct
71 Correct 28 ms 2392 KB Output is correct
72 Correct 1 ms 2396 KB Output is correct
73 Correct 1 ms 2396 KB Output is correct
74 Correct 182 ms 2620 KB Output is correct
75 Correct 1301 ms 28848 KB Output is correct
76 Correct 58 ms 3032 KB Output is correct
77 Correct 45 ms 2944 KB Output is correct
78 Correct 33 ms 2396 KB Output is correct
79 Correct 40 ms 2396 KB Output is correct
80 Correct 6 ms 2396 KB Output is correct
81 Correct 46 ms 2396 KB Output is correct
82 Correct 368 ms 15036 KB Output is correct
83 Correct 1252 ms 51584 KB Output is correct
84 Correct 48 ms 2396 KB Output is correct
85 Correct 13 ms 2544 KB Output is correct
86 Correct 43 ms 2552 KB Output is correct
87 Correct 20 ms 2392 KB Output is correct
88 Correct 232 ms 2652 KB Output is correct
89 Correct 72 ms 2536 KB Output is correct
90 Correct 75 ms 2392 KB Output is correct
91 Correct 8 ms 3672 KB Output is correct
92 Correct 13 ms 3928 KB Output is correct
93 Correct 11 ms 4700 KB Output is correct
94 Execution timed out 5024 ms 6096 KB Time limit exceeded
95 Halted 0 ms 0 KB -