Submission #151306

#TimeUsernameProblemLanguageResultExecution timeMemory
151306dfistricCipele (COCI18_cipele)C++14
18 / 90
162 ms3368 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; vector < int >l; vector < int >d; vector < int >l2; int main(){ int n,m; cin >> n >> m; if(m>n){ swap(m,n); } for(int i=0; i<n; i++){ int br; cin >> br; l.push_back(br); } for(int i=0; i<m; i++){ int br; cin >> br; d.push_back(br); } sort(l.begin(),l.end()); sort(d.begin(),d.end()); int naj; if (m==n){ naj=0; for(int i=0; i<n; i++){ if (abs(l[i]-d[i])>naj){ naj=abs(l[i]-d[i]); } } } else{ naj=0; for(int i=n-m; i<n; i++){ l2.push_back(l[i]); } for(int i=0; i<l2.size(); i++){ if (abs(d[i]-l2[i])>naj){ naj=abs(d[i]-l2[i]); } } } cout << naj; return 0; }

Compilation message (stderr)

cipele.cpp: In function 'int main()':
cipele.cpp:34:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0; i<l2.size(); 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...