# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1036364 | 2024-07-27T09:50:18 Z | beaconmc | 전선 연결 (IOI17_wiring) | C++14 | 753 ms | 262144 KB |
#include "wiring.h" #include <bits/stdc++.h> typedef long long ll; #define FOR(i,x,y) for(ll i=x; i<y; i++) #define FORNEG(i,x,y) for(ll i=x; i>y; i--) using namespace std; ll n,m; vector<ll> R,B; unordered_map<ll, ll> cache; unordered_map<ll,ll> poses; ll dp(ll x, ll y){ if (cache.count(x*1000000+y)) return cache[x*1000000+y]; if (x==n && y==m) return 0; if (x>=n || y >= m) return 1000000000000000; if (abs(poses[x]-poses[y]) > 10) return 1000000000000000; return cache[x*1000000+y] = min(dp(x+1,y), min(dp(x,y+1), dp(x+1,y+1))) + abs(R[x] - B[y]); } long long min_total_length(std::vector<int> r, std::vector<int> b) { R.clear(); B.clear(); vector<ll> stuff; for (auto&i : r) stuff.push_back(i); for (auto&i : b) stuff.push_back(i); sort(stuff.begin(), stuff.end()); FOR(i,0,stuff.size()){ poses[stuff[i]] = i; } cache.clear(); for (auto&i : r) R.push_back(i); for (auto&i : b) B.push_back(i); n = r.size(); m = b.size(); return dp(0,0); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 4 ms | 1972 KB | Output is correct |
8 | Correct | 3 ms | 1976 KB | Output is correct |
9 | Correct | 5 ms | 1976 KB | Output is correct |
10 | Correct | 4 ms | 1976 KB | Output is correct |
11 | Correct | 4 ms | 1976 KB | Output is correct |
12 | Correct | 4 ms | 1976 KB | Output is correct |
13 | Correct | 3 ms | 1976 KB | Output is correct |
14 | Correct | 4 ms | 1972 KB | Output is correct |
15 | Correct | 4 ms | 1976 KB | Output is correct |
16 | Correct | 4 ms | 1976 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 1 ms | 604 KB | 3rd lines differ - on the 1st token, expected: '84383', found: '1000000000033574' |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Runtime error | 753 ms | 262144 KB | Execution killed with signal 9 |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Incorrect | 301 ms | 110536 KB | 3rd lines differ - on the 1st token, expected: '373710605', found: '2192633020' |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 4 ms | 1972 KB | Output is correct |
8 | Correct | 3 ms | 1976 KB | Output is correct |
9 | Correct | 5 ms | 1976 KB | Output is correct |
10 | Correct | 4 ms | 1976 KB | Output is correct |
11 | Correct | 4 ms | 1976 KB | Output is correct |
12 | Correct | 4 ms | 1976 KB | Output is correct |
13 | Correct | 3 ms | 1976 KB | Output is correct |
14 | Correct | 4 ms | 1972 KB | Output is correct |
15 | Correct | 4 ms | 1976 KB | Output is correct |
16 | Correct | 4 ms | 1976 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Incorrect | 1 ms | 604 KB | 3rd lines differ - on the 1st token, expected: '84383', found: '1000000000033574' |
19 | Halted | 0 ms | 0 KB | - |