제출 #295949

#제출 시각아이디문제언어결과실행 시간메모리
295949RealSuperman1Roller Coaster Railroad (IOI16_railroad)C++14
34 / 100
75 ms11260 KiB
#include "railroad.h" #include <bits/stdc++.h> #define ll long long #define pb push_back #define fi first #define se second #define pll pair<long long, long long> #define pii pair<int, int> using namespace std; const ll INF = 1e18; int n; ll plan_roller_coaster(vector <int> s, vector <int> t) { n = s.size(); if (n > 16) return 0ll; vector < vector <ll> > w; vector < vector <ll> > dp; w.resize(n); for (int i = 0; i < n; i++) { w[i].resize(n); for (int j = 0; j < n; j++) { if (i == j) continue; w[i][j] = max(0, t[i] - s[j]); } } dp.resize((1 << n)); for (int mask = 0; mask < (1 << n); mask++) { dp[mask].resize(n); for (int i = 0; i < n; i++) dp[mask][i] = INF; } for (int i = 0; i < n; i++) dp[0][i] = 0; vector <int> b; for (int mask = 1; mask < (1 << n); mask++) { b.clear(); for (int i = 0; i < n; i++) if (1 & (mask >> i)) b.pb(i); if (b.size() == 1) { dp[mask][b[0]] = 0; continue; } for (int i = 0; i < b.size(); i++) for (int j = 0; j < b.size(); j++) { if (i == j) continue; int mask1 = (mask ^ (1 << b[i])); dp[mask][b[i]] = min(dp[mask][b[i]], dp[mask1][b[j]] + w[b[j]][b[i]]); } } ll ans = INF; for (int i = 0; i < n; i++) ans = min(ans, dp[(1 << n) - 1][i]); return ans; }

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

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:49:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |   for (int i = 0; i < b.size(); i++)
      |                   ~~^~~~~~~~~~
railroad.cpp:50:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |    for (int j = 0; j < b.size(); j++) {
      |                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...