Submission #151306

# Submission time Handle Problem Language Result Execution time Memory
151306 2019-09-02T12:20:13 Z dfistric Cipele (COCI18_cipele) C++14
18 / 90
162 ms 3368 KB
#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

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 time Memory Grader output
1 Correct 129 ms 3056 KB Output is correct
2 Correct 159 ms 3280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 158 ms 3112 KB Output is correct
2 Correct 162 ms 3184 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 130 ms 3220 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 142 ms 3368 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 125 ms 3204 KB Output isn't correct
2 Halted 0 ms 0 KB -