제출 #1069782

#제출 시각아이디문제언어결과실행 시간메모리
1069782TheQuantiXRoller Coaster Railroad (IOI16_railroad)C++17
34 / 100
68 ms15288 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll INF = 1000000000000000000LL; ll n, m, q, k, x, y, a, b, c; long long plan_roller_coaster(vector<int> s, vector<int> t) { n = (int) s.size(); if (n <= 16) { vector< vector<ll> > dp((1 << n), vector<ll>(n, INF)); ll ans = INF; for (int i = 1; i < (1 << n); i++) { vector<int> v; for (int j = 0; j < n; j++) { if ((i >> j) & 1) { v.push_back(j); } } for (auto j : v) { if (v.size() == 1) { dp[i][j] = 0; } else { for (int k = 0; k < n; k++) { if (!((i >> k) & 1) || j == k) { continue; } dp[i][j] = min(dp[i][j], dp[i - (1 << j)][k] + max(0, t[k] - s[j])); } } if (v.size() == n) { ans = min(ans, dp[i][j]); } // cout << bitset<4>(i) << ' ' << j << ' ' << dp[i][j] << '\n'; } } // cout << ans << '\n'; return ans; } vector< pair<ll, ll> > v; for (int i = 0; i < n; i++) { v.push_back({s[i], t[i]}); } sort(v.begin(), v.end()); sort(t.begin(), t.end()); ll e = 0; vector<ll> ansv; for (int i = 0; i < n; i++) { while (e < n && t[e] <= v[i].first) { e++; } // cout << e << ' ' << v[i].first << ' ' << v[i].second << '\n'; ansv.push_back(e - (v[i].second <= v[i].first ? 1 : 0)); } sort(ansv.begin(), ansv.end()); for (int i = 0; i < n; i++) { if (ansv[i] < i) { return 1; } } return 0; }

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

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:34:30: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   34 |                 if (v.size() == n) {
      |                     ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...