제출 #598790

#제출 시각아이디문제언어결과실행 시간메모리
598790denniskimSelf Study (JOI22_ho_t2)C++17
100 / 100
254 ms11436 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef __int128 lll; typedef long double ld; #define MAX 9223372036854775807LL #define MIN -9223372036854775807LL #define INF 0x3f3f3f3f3f3f3f3f #define fi first #define se second ll n; ll m; ll a[300010], b[300010]; ll l, r; int main(void) { scanf("%lld %lld", &n, &m); for(ll i = 1 ; i <= n ; i++) scanf("%lld", &a[i]); for(ll i = 1 ; i <= n ; i++) scanf("%lld", &b[i]); l = 0; r = 1000000000000000001; while(l + 1 < r) { ll mid = (l + r) / 2; ll cou = 0; for(ll i = 1 ; i <= n ; i++) { if(a[i] < b[i]) cou += (mid + b[i] - 1) / b[i]; else { if((mid + a[i] - 1) / a[i] <= m) cou += (mid + a[i] - 1) / a[i]; else { cou += m; cou += (mid - a[i] * m + b[i] - 1) / b[i]; } } if(cou > n * m) break; } if(cou > n * m) r = mid; else l = mid; } printf("%lld", l); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |  scanf("%lld %lld", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~
Main.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |   scanf("%lld", &a[i]);
      |   ~~~~~^~~~~~~~~~~~~~~
Main.cpp:26:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |   scanf("%lld", &b[i]);
      |   ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...