Submission #100012

#TimeUsernameProblemLanguageResultExecution timeMemory
100012owl10124Roller Coaster Railroad (IOI16_railroad)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "railroad.h" using namespace std; typedef long long ll; typedef pair<int,int> ii; vector<ii> segs; int n; ll m[16][1<<16]; ll dp(int seg, int bm) { if (m[seg][bm]+1) return m[seg][bm]; if (bm==(1<<n)-1) return m[seg][bm]=0; ll l = 1ll<<60-1; for (int i=0;i<n;i++) { if (((1<<i)&~bm)) l=min(l,(seg!=-1&&segs[seg].second>segs[i].first?segs[seg].second-segs[i].first:0)+dp(i,bm|(1<<i))); } //printf("%d %d %d %lld\n",segs[seg].second,seg,bm,l); return m[seg][bm]=l; } ll plan_roller_coaster(std::vector<int> s, std::vector<int> t) { fill(&m[0][0],&m[n][0],-1); n = (int) s.size(); for (int i=0;i<n;i++) segs.push_back(make_pair(s[i],t[i])); return dp(-1,0); } int main() { int n; assert(1 == scanf("%d", &n)); std::vector<int> s(n), t(n); for (int i = 0; i < n; ++i) assert(2 == scanf("%d%d", &s[i], &t[i])); long long ans = plan_roller_coaster(s, t); printf("%lld\n", ans); return 0; }

Compilation message (stderr)

railroad.cpp: In function 'll dp(int, int)':
railroad.cpp:16:19: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
     ll l = 1ll<<60-1;
                 ~~^~
/tmp/ccYdr7Sy.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccDaL2to.o:railroad.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status