제출 #105458

#제출 시각아이디문제언어결과실행 시간메모리
105458polyfishRoller Coaster Railroad (IOI16_railroad)C++14
컴파일 에러
0 ms0 KiB
//Pantyhose(black) + glasses = infinity #include <bits/stdc++.h> using namespace std; #define debug(x) cerr << #x << " = " << x << '\n'; #define BP() cerr << "OK!\n"; #define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';} #define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';} #define FILE_NAME "data" const int64_t INF = 1e18; int n; vector<pair<int, int> > a; int64_t f[1<<16][16]; int64_t dp(int mask, int last) { if (__builtin_popcount(mask)==n) return 0; if (f[mask][last]>-1) return f[mask][last]; int64_t res = INF; for (int i=0; i<n; ++i) { if (((mask>>i) & 1)==0) { int new_mask = mask | (1<<i); // if (mask==11 && last==1 && i==2) // debug(); res = min(res, dp(new_mask, i) + max(0, a[last].second - a[i].first)); } } return f[mask][last] = res; } int64_t plan_roller_coaster(vector<int> s, vector<int> t) { n = s.size(); a.resize(n); for (int i=0; i<n; ++i) a[i] = {s[i], t[i]}; sort(a.begin(), a.end()); if (n<=16) { memset(f, -1, sizeof(f)); // debug(dp(1, 0)); int64_t res = INF; for (int i=0; i<n; ++i) res = min(res, dp(1<<i, i)); return res; } } int main() { #ifdef GLASSES_GIRL freopen(FILE_NAME".in", "r", stdin); freopen(FILE_NAME".out", "w", stdout); #endif ios::sync_with_stdio(0); cin.tie(0); cin >> n; vector<int> s(n), t(n); for (int i=0; i<n; ++i) cin >> s[i]; for (int i=0; i<n; ++i) cin >> t[i]; cout << plan_roller_coaster(s, t); }

컴파일 시 표준 에러 (stderr) 메시지

railroad.cpp: In function 'int64_t plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:57:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/tmp/ccVzj4LN.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccie6Y35.o:railroad.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status