Submission #742648

# Submission time Handle Problem Language Result Execution time Memory
742648 2023-05-16T16:14:02 Z matu Cipele (COCI18_cipele) C++14
27 / 90
1000 ms 8276 KB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
#pragma GCC optimize ("O1")
#define ezurect int T; cin >> T; while(T--){solve();}
#pragma optimize ("")
const int N = 1e6 + 1, mod = 1e9 + 7;

int n, m;
vector<int> v(N), w(N);
int main(){
    cin.tie(0)->sync_with_stdio(0);
    cin >> n >> m;
    for(int i = 1; i <= n; i++) cin >> v[i];
    for(int i = 1; i <= m; i++) cin >> w[i];
    sort(v.begin() + 1, v.begin() + 1 + n);
    sort(w.begin() + 1, w.begin() + 1 + m);
    if(n > m){
        swap(v, w);
        swap(n, m);
    }
    long long ans = 1e17;
    for(int i = 1; i <= m - n + 1; i++){
        long long res = 0;
        for(int j = 1; j <= n; j++){
            res = max(res, 1LL * abs(w[i + j - 1] - v[j]));
        }
        ans = min(ans, res);
    }
    cout << ans;
}

Compilation message

cipele.cpp:8: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    8 | #pragma optimize ("")
      |
# Verdict Execution time Memory Grader output
1 Correct 22 ms 8276 KB Output is correct
2 Correct 36 ms 8276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 8272 KB Output is correct
2 Correct 39 ms 8276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 8148 KB Output is correct
2 Correct 6 ms 8180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 8148 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 8176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 8148 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 8276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 8276 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 903 ms 8268 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 8172 KB Time limit exceeded
2 Halted 0 ms 0 KB -