Submission #798749

# Submission time Handle Problem Language Result Execution time Memory
798749 2023-07-31T03:10:58 Z NeroZein Roller Coaster Railroad (IOI16_railroad) C++17
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"
using namespace std;

const long long INF = 1e18;

int main(){
  int n, c;
  cin >> n >> c;
  vector<int> s(n), t(n); 
  for (int i = 0; i < n; ++i) {
    cin >> s[i] >> t[i];
  }
  vector<vector<long long>> dp(1 << n, vector<long long> (n, INF));
  for (int i = 0; i < n; ++i) {
    dp[1 << i][i] = 0; 
  }
  for (int msk = 1; msk < (1 << n); ++msk) {
    for (int i = 0; i < n; ++i) {
      if (!(msk >> i & 1)) continue;
      for (int j = 0; j < n; ++j) {
        if (msk >> j & 1) continue;
        dp[msk | (1 << j)][j] = min(dp[msk | (1 << j)][j], dp[msk][i] + max(0, t[i] - s[j]));
      }
    }
  }
  long long ans = INF;
  for (int i = 0; i < n; ++i) {
    ans = min(ans, dp[(1 << n) - 1][i]); 
  }
  cout << ans << '\n'; 
  return 0; 
}

Compilation message

/usr/bin/ld: /tmp/ccf9YXUS.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cciE48pQ.o:railroad.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccf9YXUS.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