제출 #1069663

#제출 시각아이디문제언어결과실행 시간메모리
1069663mc061Roller Coaster Railroad (IOI16_railroad)C++17
0 / 100
352 ms524288 KiB
#pragma once #include <bits/stdc++.h> using namespace std; long long plan_roller_coaster(vector<int> s, vector<int> t) { const int n = s.size(); int64_t ham_path[1<<n][n]; for (int i = 0; i < (1<<n); ++i) { fill(ham_path[i], ham_path[i]+n, 1e18); } int64_t dist[n][n]; ham_path[0][0] = 0; for (int i = 0; i < n; ++i) { ham_path[1<<i][i] = 0; } for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { if (i==j) { dist[i][j]=1e18; continue; } dist[i][j] = min<int64_t>(dist[i][j], max(0, t[i]-s[j])); } } for (int m = 1; m < (1<<n); ++m) { vector<int> bits; for (int bit = 0; bit < n; ++bit) { if ((m & (1 << bit)) == 0) continue; bits.push_back(bit); } if (bits.size() == 1) { continue; } for (int i = 0; i < bits.size(); ++i) { int prev_m = m ^ (1 << bits[i]); for (int j = 0; j < bits.size(); ++j) { if (i == j) continue; ham_path[m][bits[i]] = min(ham_path[m][bits[i]], ham_path[prev_m][bits[j]] + dist[bits[j]][bits[i]]); } } } return *min_element(ham_path[(1<<n)-1], ham_path[(1<<n)-1]+n); }

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

railroad.cpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:37:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         for (int i = 0; i < bits.size(); ++i) {
      |                         ~~^~~~~~~~~~~~~
railroad.cpp:39:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             for (int j = 0; j < bits.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...