Submission #83455

#TimeUsernameProblemLanguageResultExecution timeMemory
83455charlies_mooCipele (COCI18_cipele)C++17
Compilation error
0 ms0 KiB
#include <cstdio> #include <algorithm> using namespace std; int main() { int n, m; scanf("%d %d", &n, &m); int *a = new int[n]; for (int i = 0; i < n; i++) { scanf("%d", &a[i]); } int *b = new int[m]; for (int i = 0; i < m; i++) { scanf("%d", &b[i]); } sort(a, a+n); sort(b, b+m); if (n > m) { swap(n, m); swap(a, b) } 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 && b[j] < a[i] - mi) { j++; } if (j == m || b[j] > a[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:23:5: error: expected ';' before '}' token
     }
     ^
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]);
         ~~~~~^~~~~~~~~~~~~