Submission #236217

#TimeUsernameProblemLanguageResultExecution timeMemory
236217MarcoMeijerWiring (IOI17_wiring)C++14
Compilation error
0 ms0 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; //macros typedef long long ll; typedef pair<ll, ll> ii; typedef tuple<ll, ll, ll> iii; typedef vector<ll> vi; typedef vector<ii> vii; typedef vector<iii> viii; typedef vector<ll> vll; #define REP(a,b,c) for(ll a=ll(b); a<ll(c); a++) #define RE(a,c) REP(a,0,c) #define RE1(a,c) REP(a,1,c+1) #define REI(a,b,c) REP(a,b,c+1) #define REV(a,b,c) for(ll a=ll(c-1); a>=ll(b); a--) #define INF 1e18 #define pb push_back #define fi first #define se second #define sz size() //===================// // begin program // //===================// const ll MX = 5e5; vi pos, col; bitset<MX> connected; ll n, m, N; ll nxtC[MX]; ll dp[MX]; ll gd(ll i, ll j) { return abs(pos[i] - pos[j]); } ll getCost(ll x, ll y, ll cent) { ll ans = 0; return ans; } long long min_total_length(std::vector<ll> r, std::vector<ll> b) { n = r.sz, m = b.sz; N = n+m; { ll i=0, j=0; while(i != n || j != m) { if(j == m || (i != n && r[i] < b[j])) { pos.pb(r[i++]); col.pb(0); } else { pos.pb(b[j++]); col.pb(1); } } } dp[0] = 0; ll beg = -1, cent=-1, lastCol=-1; ll regionMin = INF; REP(i,1,N+1) { if(col[i-1] != lastCol) { lastCol = col[i-1]; beg = cent; cent = i-1; regionMin = dp[i-1]; } dp[i] = INF; ll mn = regionMin; if(beg == -1) continue; ll y = i-1; REV(x,beg,cent+1) { mn = min(mn, dp[x]); ll cst = 0; REP(i,x,cent) cst -= pos[i]; REP(i,cent,y+1) cst += pos[i]; if(cent-x < y-cent+1) { cst += pos[cent - 1] * (2*cent - x - y - 1); } else { cst += pos[cent] * (2*cent - x - y - 1); } dp[i] = min(dp[i], dp[x]+cst); } regionMin = min(regionMin, dp[i]); } return dp[N]; }

Compilation message (stderr)

/tmp/ccRvG7V7.o: In function `main':
grader.cpp:(.text.startup+0x23b): undefined reference to `min_total_length(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status