Submission #472319

#TimeUsernameProblemLanguageResultExecution timeMemory
472319MamdouhNCipele (COCI18_cipele)C++14
27 / 90
103 ms2728 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" vector<int>L,R; main() { int n,m; cin>>n>>m; for(int i=0;i<n;i++) { int x; cin>>x; L.push_back(x); } for(int i=0;i<m;i++) { int x; cin>>x; R.push_back(x); } sort(L.begin(),L.end()); sort(R.begin(),R.end()); if(n>m) { swap(n,m); swap(L,R); } int st=0,en=m-1; while(en-st+1>L.size()) { int s = abs(R[st] - L[0]); int e = abs(R[en] - L[n-1]); if(s<e)en--; else st++; } int ans=0; for(int i=0;i<n;i++) { int x = abs(L[i]-R[st]); ans=max(ans,x); st++; } cout<<ans<<endl; }

Compilation message (stderr)

cipele.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~
cipele.cpp: In function 'int main()':
cipele.cpp:34:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     while(en-st+1>L.size())
      |           ~~~~~~~^~~~~~~~~
#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...