Submission #692249

#TimeUsernameProblemLanguageResultExecution timeMemory
692249bdlSelf Study (JOI22_ho_t2)C++17
0 / 100
1 ms212 KiB
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <array> #include <iostream> using namespace std; const int N = 3e5; const long long INF = 1e18; int main() { int n, m; scanf("%d%d", &n, &m); static int a[N], b[N]; for (int i = 0; i < n; i++) scanf("%d", &a[i]); for (int i = 0; i < n; i++) { scanf("%d", &b[i]); a[i] = max(a[i], b[i]); } long long low = 0, hi = INF; while (low < hi) { long long t = (low + hi) / 2 + 1, c = 0; for (int i = 0; i < n; i++) { long long x = (t - 1) / a[i] + 1; if (x <= m) c += m - x; else c = max(-INF, c - (t - 1LL * m * a[i] - 1) / b[i] + 1); } if (c >= 0) low = t; else hi = t - 1; } printf("%lld\n", low); return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d%d", &n, &m);
      |   ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf("%d", &a[i]);
      |     ~~~~~^~~~~~~~~~~~~
Main.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     scanf("%d", &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...