# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
822940 | 2023-08-12T05:30:41 Z | Minindu206 | Wiring (IOI17_wiring) | C++14 | 1 ms | 340 KB |
#include "wiring.h" #include <bits/stdc++.h> #define ll long long using namespace std; long long min_total_length(std::vector<int> r, std::vector<int> b) { int n = r.size(), m = b.size(); if(n <= 200 && m <= 200) { ll ans = 0; vector<int> visb(m, 0); for(int i=0;i<n;i++) { int mn = -1, val = INT_MAX; for(int j=0;j<m;j++) { if(visb[j]) continue; int cur = abs(r[i] - b[j]); if(cur < val) mn = j, val = cur; } visb[mn] = 1; ans += val; } for(int j=0;j<m;j++) { if(visb[j] == 1) continue; int mn = -1, val = INT_MAX; for(int i=0;i<n;i++) { int cur = abs(r[i] - b[j]); if(cur < val) mn = i, val = cur; } ans += val; } return ans; } ll rmx = r[n - 1]; ll ans = 0; for (int i = 0; i < m; i++) ans += b[i] - rmx; for (int i = 0; i < n - 1; i++) ans += rmx - r[i]; ans += max((ll)(n - m) * (b[0] - rmx), 0LL); return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 340 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 340 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '17703', found: '19704' |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '27', found: '32' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 340 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |