Submission #95200

#TimeUsernameProblemLanguageResultExecution timeMemory
95200OrtCipele (COCI18_cipele)C++11
90 / 90
46 ms2936 KiB
#include<algorithm> #include<iostream> #include<vector> #include<cmath> using namespace std; int main() { cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit); int n, m; cin >> n >> m; vector<int> a(n), b(m); for(int i=0;i<n;i++) cin >> a[i]; for(int i=0;i<m;i++) cin >> b[i]; sort(a.begin(),a.end()); sort(b.begin(),b.end()); if(n>m) swap(a,b); int low = -1, high = 1e9, mid, t; bool valid; while(high-low>1) { mid = (low+high)>>1; t = 0; valid = 1; for(int i=0;i<a.size();i++) { if(t>=b.size()) { valid = 0; break; } while(t<b.size() && b[t]<=a[i] && a[i]-b[t]>mid) t++; if(t>=b.size() || abs(a[i]-b[t])>mid) { valid = 0; break; } t++; } if(valid) high = mid; else low = mid; } cout << high; return 0; }

Compilation message (stderr)

cipele.cpp: In function 'int main()':
cipele.cpp:23:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<a.size();i++) {
               ~^~~~~~~~~
cipele.cpp:24:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(t>=b.size()) {
       ~^~~~~~~~~~
cipele.cpp:28:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    while(t<b.size() && b[t]<=a[i] && a[i]-b[t]>mid) t++;
          ~^~~~~~~~~
cipele.cpp:29:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(t>=b.size() || abs(a[i]-b[t])>mid) {
       ~^~~~~~~~~~
#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...