Submission #83354

#TimeUsernameProblemLanguageResultExecution timeMemory
83354charlies_mooCipele (COCI18_cipele)C++17
90 / 90
97 ms11196 KiB
#include <cstdio> #include <algorithm> using namespace std; int main() { int n, m; scanf("%d %d", &n, &m); int a[n]; for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } int b[m]; for (int i = 0; i < m; i++) { scanf("%d", &b[i]); } sort(a, a+n); sort(b, b+m); int *p, *q; if (n < m) { p = a; q = b; } else { swap(n, m); p = b; q = a; } int l = -1, r = 1e9+1; while (r - l > 1) { int mi = (l + r) / 2; bool flag = true; int j = 0; for (int i = 0; i < n; i++) { while (j < m && q[j] < p[i] - mi) { j++; } if (j == m || q[j] > p[i] + mi) { flag = false; break; } j++; } if (flag) { r = mi; } else { l = mi; } } printf("%d\n", r); return 0; }

Compilation message (stderr)

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