답안 #1029560

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1029560 2024-07-21T04:09:54 Z vjudge1 Wish (LMIO19_noras) C++17
93 / 100
115 ms 18872 KB
// 23 - 12 - 23 

#include<bits/stdc++.h>

using namespace std;

#define read() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define day() time_t now = time(0);char* x = ctime(&now);cerr<<"Right Now Is : "<<x<<"\n"

#define int long long
#define ii pair<int,int>
#define X first
#define Y second 

const long long MAX = (int)2e5 + 5;
const long long INF = (int)1e9;
const long long MOD = (int)1e9 + 7;

int n,r;
int a[MAX],b[MAX],c[MAX],d[MAX];

signed main(){
	
	read();
	
	cin >> n >> r;
	
	// (x) ^ 2 + y ^ 2 = r ^ 2 
	// a[i] + t * u , b[i] + t * v
	// (a + tu) ^ 2 + (b + tv) ^ 2 = r 
	// t ^ 2 * (u ^ 2 + v ^ 2) + 2t(au + bv) + a ^ 2 + b ^ 2 - r ^ 2 = 0
	vector<ii> sweep;
	
	for(int i = 1;i <= n;i++){
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		
		int u = c[i] - a[i];
		int v = d[i] - b[i];
		
		int _a = u * u + v * v;
		int _b = 2 * (a[i] * u + b[i] * v);
		int _c = a[i] * a[i] + b[i] * b[i] - r * r;
		
		// _aX^2 + _bX + _c = 0
		
		int dental = _b * _b - 4 * _a * _c;
		
		if(dental >= 0){
			long double x_1 = (-_b - sqrt(dental)) / (2 * _a);
			long double x_2 = (-_b + sqrt(dental)) / (2 * _a);
			
			int inside = ceil(min(x_1,x_2));
			int outside = floor(max(x_2,x_1));
			
			if(inside <= outside){
				//cout << i << " " << inside << " " << outside << "\n";
				sweep.push_back({inside,0});
				sweep.push_back({outside,1});
			}
		}
		
	}	
	
	sort(sweep.begin(),sweep.end(),[&](const ii &a,const ii &b){
		return (a.X == b.X) ? (a.Y < b.Y) : (a.X < b.X);
	});
	
	int res = 0;
	int cnt = 0;
	
	for(auto e : sweep){
		
		if(e.X >= 0)
			res = max(res,cnt);
		cnt += (e.Y == 0 ? 1 : -1);
	}
	
	cout << res;
	
	
	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4700 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 2 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4700 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 2 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 35 ms 11220 KB Output is correct
24 Correct 31 ms 11476 KB Output is correct
25 Correct 29 ms 10964 KB Output is correct
26 Correct 28 ms 12756 KB Output is correct
27 Correct 26 ms 8908 KB Output is correct
28 Correct 34 ms 12244 KB Output is correct
29 Correct 36 ms 12544 KB Output is correct
30 Correct 42 ms 11212 KB Output is correct
31 Correct 37 ms 12556 KB Output is correct
32 Correct 49 ms 11212 KB Output is correct
33 Correct 36 ms 11220 KB Output is correct
34 Correct 46 ms 11972 KB Output is correct
35 Correct 44 ms 11476 KB Output is correct
36 Correct 47 ms 11980 KB Output is correct
37 Correct 28 ms 9104 KB Output is correct
38 Correct 40 ms 9172 KB Output is correct
39 Correct 25 ms 8912 KB Output is correct
40 Correct 36 ms 8764 KB Output is correct
41 Correct 33 ms 8912 KB Output is correct
42 Correct 35 ms 9176 KB Output is correct
43 Correct 115 ms 17336 KB Output is correct
44 Correct 104 ms 18616 KB Output is correct
45 Correct 97 ms 18108 KB Output is correct
46 Correct 100 ms 18872 KB Output is correct
47 Correct 83 ms 17596 KB Output is correct
48 Correct 87 ms 18376 KB Output is correct
49 Correct 75 ms 17096 KB Output is correct
50 Correct 88 ms 16840 KB Output is correct
51 Correct 73 ms 17608 KB Output is correct
52 Correct 99 ms 16840 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4700 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 2 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 1 ms 4444 KB Output is correct
24 Correct 1 ms 4696 KB Output is correct
25 Correct 1 ms 4444 KB Output is correct
26 Correct 1 ms 4588 KB Output is correct
27 Correct 1 ms 4444 KB Output is correct
28 Correct 1 ms 2552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4700 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 2 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 35 ms 11220 KB Output is correct
24 Correct 31 ms 11476 KB Output is correct
25 Correct 29 ms 10964 KB Output is correct
26 Correct 28 ms 12756 KB Output is correct
27 Correct 26 ms 8908 KB Output is correct
28 Correct 34 ms 12244 KB Output is correct
29 Correct 36 ms 12544 KB Output is correct
30 Correct 42 ms 11212 KB Output is correct
31 Correct 37 ms 12556 KB Output is correct
32 Correct 49 ms 11212 KB Output is correct
33 Correct 36 ms 11220 KB Output is correct
34 Correct 46 ms 11972 KB Output is correct
35 Correct 44 ms 11476 KB Output is correct
36 Correct 47 ms 11980 KB Output is correct
37 Correct 28 ms 9104 KB Output is correct
38 Correct 40 ms 9172 KB Output is correct
39 Correct 25 ms 8912 KB Output is correct
40 Correct 36 ms 8764 KB Output is correct
41 Correct 33 ms 8912 KB Output is correct
42 Correct 35 ms 9176 KB Output is correct
43 Correct 115 ms 17336 KB Output is correct
44 Correct 104 ms 18616 KB Output is correct
45 Correct 97 ms 18108 KB Output is correct
46 Correct 100 ms 18872 KB Output is correct
47 Correct 83 ms 17596 KB Output is correct
48 Correct 87 ms 18376 KB Output is correct
49 Correct 75 ms 17096 KB Output is correct
50 Correct 88 ms 16840 KB Output is correct
51 Correct 73 ms 17608 KB Output is correct
52 Correct 99 ms 16840 KB Output is correct
53 Correct 1 ms 4444 KB Output is correct
54 Correct 1 ms 4696 KB Output is correct
55 Correct 1 ms 4444 KB Output is correct
56 Correct 1 ms 4588 KB Output is correct
57 Correct 1 ms 4444 KB Output is correct
58 Correct 1 ms 2552 KB Output is correct
59 Correct 38 ms 10700 KB Output is correct
60 Correct 44 ms 11980 KB Output is correct
61 Correct 40 ms 11988 KB Output is correct
62 Correct 46 ms 9488 KB Output is correct
63 Correct 49 ms 12236 KB Output is correct
64 Correct 41 ms 10372 KB Output is correct
65 Correct 45 ms 11980 KB Output is correct
66 Correct 44 ms 11988 KB Output is correct
67 Correct 45 ms 10448 KB Output is correct
68 Correct 52 ms 10964 KB Output is correct
69 Correct 46 ms 11724 KB Output is correct
70 Correct 52 ms 9672 KB Output is correct
71 Correct 45 ms 10976 KB Output is correct
72 Correct 47 ms 9684 KB Output is correct
73 Correct 42 ms 9008 KB Output is correct
74 Correct 36 ms 11212 KB Output is correct
75 Correct 35 ms 11476 KB Output is correct
76 Correct 37 ms 8912 KB Output is correct
77 Correct 102 ms 18560 KB Output is correct
78 Correct 97 ms 18480 KB Output is correct
79 Correct 92 ms 17608 KB Output is correct
80 Correct 78 ms 18276 KB Output is correct
81 Correct 87 ms 17348 KB Output is correct
82 Correct 94 ms 16780 KB Output is correct
83 Correct 88 ms 16900 KB Output is correct
84 Correct 77 ms 17604 KB Output is correct
85 Correct 78 ms 17608 KB Output is correct
86 Correct 94 ms 17092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4700 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 2 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 35 ms 11220 KB Output is correct
24 Correct 31 ms 11476 KB Output is correct
25 Correct 29 ms 10964 KB Output is correct
26 Correct 28 ms 12756 KB Output is correct
27 Correct 26 ms 8908 KB Output is correct
28 Correct 34 ms 12244 KB Output is correct
29 Correct 36 ms 12544 KB Output is correct
30 Correct 42 ms 11212 KB Output is correct
31 Correct 37 ms 12556 KB Output is correct
32 Correct 49 ms 11212 KB Output is correct
33 Correct 36 ms 11220 KB Output is correct
34 Correct 46 ms 11972 KB Output is correct
35 Correct 44 ms 11476 KB Output is correct
36 Correct 47 ms 11980 KB Output is correct
37 Correct 28 ms 9104 KB Output is correct
38 Correct 40 ms 9172 KB Output is correct
39 Correct 25 ms 8912 KB Output is correct
40 Correct 36 ms 8764 KB Output is correct
41 Correct 33 ms 8912 KB Output is correct
42 Correct 35 ms 9176 KB Output is correct
43 Correct 115 ms 17336 KB Output is correct
44 Correct 104 ms 18616 KB Output is correct
45 Correct 97 ms 18108 KB Output is correct
46 Correct 100 ms 18872 KB Output is correct
47 Correct 83 ms 17596 KB Output is correct
48 Correct 87 ms 18376 KB Output is correct
49 Correct 75 ms 17096 KB Output is correct
50 Correct 88 ms 16840 KB Output is correct
51 Correct 73 ms 17608 KB Output is correct
52 Correct 99 ms 16840 KB Output is correct
53 Correct 38 ms 10700 KB Output is correct
54 Correct 44 ms 11980 KB Output is correct
55 Correct 40 ms 11988 KB Output is correct
56 Correct 46 ms 9488 KB Output is correct
57 Correct 49 ms 12236 KB Output is correct
58 Correct 41 ms 10372 KB Output is correct
59 Correct 45 ms 11980 KB Output is correct
60 Correct 44 ms 11988 KB Output is correct
61 Correct 45 ms 10448 KB Output is correct
62 Correct 52 ms 10964 KB Output is correct
63 Correct 46 ms 11724 KB Output is correct
64 Correct 52 ms 9672 KB Output is correct
65 Correct 45 ms 10976 KB Output is correct
66 Correct 47 ms 9684 KB Output is correct
67 Correct 42 ms 9008 KB Output is correct
68 Correct 36 ms 11212 KB Output is correct
69 Correct 35 ms 11476 KB Output is correct
70 Correct 37 ms 8912 KB Output is correct
71 Correct 102 ms 18560 KB Output is correct
72 Correct 97 ms 18480 KB Output is correct
73 Correct 92 ms 17608 KB Output is correct
74 Correct 78 ms 18276 KB Output is correct
75 Correct 87 ms 17348 KB Output is correct
76 Correct 94 ms 16780 KB Output is correct
77 Correct 88 ms 16900 KB Output is correct
78 Correct 77 ms 17604 KB Output is correct
79 Correct 78 ms 17608 KB Output is correct
80 Correct 94 ms 17092 KB Output is correct
81 Correct 1 ms 4444 KB Output is correct
82 Correct 1 ms 4696 KB Output is correct
83 Correct 1 ms 4444 KB Output is correct
84 Correct 1 ms 4588 KB Output is correct
85 Correct 1 ms 4444 KB Output is correct
86 Correct 1 ms 2552 KB Output is correct
87 Incorrect 44 ms 14712 KB Output isn't correct
88 Halted 0 ms 0 KB -