답안 #602298

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
602298 2022-07-22T20:51:58 Z IvanJ Self Study (JOI22_ho_t2) C++17
10 / 100
105 ms 11412 KB
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

const int maxn = 3e5 + 5;

int n;
ll m;
ll A[maxn], B[maxn];

int check(ll x) {
	ll ret = 0;
	for(int i = 0;i < n;i++) {
		ll a = max(A[i], B[i]) * m;
		if(x > a) ret -= (x - a + B[i] - 1) / B[i];
		else ret += (a - x) / max(A[i], B[i]);
	}
	return (ret >= 0);
}

int main() {
	ll ans = 1e18;
	scanf("%d%lld", &n, &m);
	for(int i = 0;i < n;i++) scanf("%lld", A + i);
	for(int i = 0;i < n;i++) scanf("%lld", B + i), ans = min(ans, max(A[i], B[i]));
	
	/*ll lo = 0, hi = 1e18, ans = -1;
	while(lo <= hi) {
		ll mid = (lo + hi) / 2;
		if(check(mid)) 
			ans = mid, lo = mid + 1;
		else hi = mid - 1;
	}*/
	printf("%lld\n", ans);
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |  scanf("%d%lld", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~~~
Main.cpp:26:32: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |  for(int i = 0;i < n;i++) scanf("%lld", A + i);
      |                           ~~~~~^~~~~~~~~~~~~~~
Main.cpp:27:32: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |  for(int i = 0;i < n;i++) scanf("%lld", B + i), ans = min(ans, max(A[i], B[i]));
      |                           ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 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 1 ms 260 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 70 ms 4872 KB Output is correct
12 Correct 74 ms 4936 KB Output is correct
13 Correct 59 ms 4888 KB Output is correct
14 Correct 70 ms 4864 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 54 ms 6044 KB Output is correct
17 Correct 105 ms 11412 KB Output is correct
18 Correct 64 ms 10772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 54 ms 6044 KB Output is correct
3 Correct 105 ms 11412 KB Output is correct
4 Correct 64 ms 10772 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 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 1 ms 260 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 70 ms 4872 KB Output is correct
12 Correct 74 ms 4936 KB Output is correct
13 Correct 59 ms 4888 KB Output is correct
14 Correct 70 ms 4864 KB Output is correct
15 Incorrect 1 ms 212 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 1 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 1 ms 260 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 70 ms 4872 KB Output is correct
12 Correct 74 ms 4936 KB Output is correct
13 Correct 59 ms 4888 KB Output is correct
14 Correct 70 ms 4864 KB Output is correct
15 Incorrect 1 ms 212 KB Output isn't correct
16 Halted 0 ms 0 KB -