답안 #937997

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
937997 2024-03-04T17:30:24 Z Litusiano Self Study (JOI22_ho_t2) C++17
62 / 100
206 ms 5208 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
 
vector<pair<int,int>> v;
int n,m;
bool check(int mid){
	int tot = 0;
	for(auto x : v){
		if(tot > n*m) break;
		int mx = max(x.first,x.second);
		int need = (mid+mx-1)/mx;
		if(need < 0) continue;
		if(need > m){
			tot+=m;
			int k = (mid-mx*m + x.second-1);
			if(k < 0) continue;
			tot+= (k)/x.second;
		}
		else tot+= need;
	}
	return tot <= n*m;
}
 
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>m;
	v.resize(n);
	for(auto& x : v) cin>>x.first; for(auto& x : v) cin>>x.second;
	int low = 0; int high = 1e18+5;
	while(high > low+1){
		int middle = (low+high)/2;
		if(check(middle)) low = middle;
		else high = middle;
	}
	cout<<low<<endl;
}	

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:31:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   31 |  for(auto& x : v) cin>>x.first; for(auto& x : v) cin>>x.second;
      |  ^~~
Main.cpp:31:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   31 |  for(auto& x : v) cin>>x.first; for(auto& x : v) cin>>x.second;
      |                                 ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 82 ms 4956 KB Output is correct
12 Correct 82 ms 4956 KB Output is correct
13 Correct 78 ms 4956 KB Output is correct
14 Correct 56 ms 4952 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 27 ms 4956 KB Output is correct
17 Correct 88 ms 5208 KB Output is correct
18 Correct 95 ms 4956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 27 ms 4956 KB Output is correct
3 Correct 88 ms 5208 KB Output is correct
4 Correct 95 ms 4956 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 43 ms 2652 KB Output is correct
14 Correct 29 ms 1884 KB Output is correct
15 Correct 21 ms 1624 KB Output is correct
16 Correct 19 ms 1372 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 3 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 82 ms 4956 KB Output is correct
12 Correct 82 ms 4956 KB Output is correct
13 Correct 78 ms 4956 KB Output is correct
14 Correct 56 ms 4952 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 43 ms 2652 KB Output is correct
24 Correct 29 ms 1884 KB Output is correct
25 Correct 21 ms 1624 KB Output is correct
26 Correct 19 ms 1372 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 3 ms 600 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 27 ms 4956 KB Output is correct
36 Correct 88 ms 5208 KB Output is correct
37 Correct 95 ms 4956 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 2 ms 348 KB Output is correct
46 Correct 3 ms 600 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 16 ms 1116 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 3 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 47 ms 2652 KB Output is correct
56 Correct 31 ms 1880 KB Output is correct
57 Correct 21 ms 1884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 43 ms 2652 KB Output is correct
10 Correct 29 ms 1884 KB Output is correct
11 Correct 21 ms 1624 KB Output is correct
12 Correct 19 ms 1372 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 3 ms 600 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 27 ms 4956 KB Output is correct
22 Correct 88 ms 5208 KB Output is correct
23 Correct 95 ms 4956 KB Output is correct
24 Correct 28 ms 1112 KB Output is correct
25 Correct 68 ms 2396 KB Output is correct
26 Correct 12 ms 864 KB Output is correct
27 Correct 78 ms 4952 KB Output is correct
28 Correct 89 ms 4956 KB Output is correct
29 Correct 92 ms 4952 KB Output is correct
30 Correct 119 ms 4952 KB Output is correct
31 Correct 194 ms 4952 KB Output is correct
32 Correct 138 ms 4956 KB Output is correct
33 Incorrect 206 ms 4952 KB Output isn't correct
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 82 ms 4956 KB Output is correct
12 Correct 82 ms 4956 KB Output is correct
13 Correct 78 ms 4956 KB Output is correct
14 Correct 56 ms 4952 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 43 ms 2652 KB Output is correct
24 Correct 29 ms 1884 KB Output is correct
25 Correct 21 ms 1624 KB Output is correct
26 Correct 19 ms 1372 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 3 ms 600 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 2 ms 348 KB Output is correct
42 Correct 3 ms 600 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 16 ms 1116 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 3 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 47 ms 2652 KB Output is correct
52 Correct 31 ms 1880 KB Output is correct
53 Correct 21 ms 1884 KB Output is correct
54 Correct 28 ms 1112 KB Output is correct
55 Correct 68 ms 2396 KB Output is correct
56 Correct 12 ms 864 KB Output is correct
57 Correct 78 ms 4952 KB Output is correct
58 Correct 89 ms 4956 KB Output is correct
59 Correct 92 ms 4952 KB Output is correct
60 Correct 119 ms 4952 KB Output is correct
61 Correct 194 ms 4952 KB Output is correct
62 Correct 138 ms 4956 KB Output is correct
63 Incorrect 206 ms 4952 KB Output isn't correct
64 Halted 0 ms 0 KB -