제출 #477821

#제출 시각아이디문제언어결과실행 시간메모리
477821BackNoobRoller Coaster Railroad (IOI16_railroad)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define fi first #define se second #define endl '\n' #define mask(i) (1LL << (i)) #define task "name" #define ull unsigned long long using namespace std; const ll mxN = 220797 + 7; const ll inf = 1e9 + 277; const ll mod = 2147483648; const ll infll = 1e18 + 7; const ll base = 307; template <typename T1, typename T2> bool minimize(T1 &a, T2 b) { if (a > b) {a = b; return true;} return false; } template <typename T1, typename T2> bool maximize(T1 &a, T2 b) { if (a < b) {a = b; return true;} return false; } int s[mxN] , t[mxN]; ll dp[(1 << 16)][20]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); //freopen("railroad.inp" , "r" , stdin); //freopen("railroad.out" , "w" , stdout); int n; cin >> n; if(n > 16) return 0; for(int i = 0 ; i < n ; i++) cin >> s[i] >> t[i]; memset(dp , 0x3f , sizeof(dp)); for(int mask = 0 ; mask < (1 << n) ; mask++) { if(mask == 0) { for(int i = 0 ; i < n ; i++) { if(!(mask & (1 << i)) && s[i] <= 1) { dp[mask | (1 << i)][i] = 0; } } } else { for(int i = 0 ; i < n ; i++) { if((mask & (1 << i)) && dp[mask][i] != dp[0][0]) { for(int j = 0 ; j < n ; j++) { if(!(mask & (1 << j))) { minimize(dp[mask | (1 << j)][j] , dp[mask][i] + max(0 , t[i] - s[j])); } } } } } } ll res = dp[0][0]; for(int i = 0 ; i < n ; i++) { minimize(res , dp[(1 << n) - 1][i]); } cout << res; return 0; }

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

/usr/bin/ld: /tmp/ccOqb1d0.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cchHcKPW.o:railroad.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccOqb1d0.o: in function `main':
grader.cpp:(.text.startup+0xf4): undefined reference to `plan_roller_coaster(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status