제출 #786754

#제출 시각아이디문제언어결과실행 시간메모리
786754mindiyakRoller Coaster Railroad (IOI16_railroad)C++14
11 / 100
2075 ms524288 KiB
#include "railroad.h" #include <iostream> #include <unordered_set> #include <set> #define ll long long using namespace std; const int MAXN = (2*1e5)+2; // const int MAXN = 100; vector<int> S; vector<int> T; long long ans = 1e18; ll getCost(int start,int end){ // cout << start << " " << end << " " << T[start] << " " << S[end] << endl; return max(0,T[start]-S[end]); } void dfs(int n,int pos,unordered_set<int> visited,ll cost){ if(cost >= ans){ return; } visited.insert(pos); if(visited.size() == n){ ans = min(ans,cost); return; } set<pair<int,int>> possibilities; for(int i=0;i<n;i++){ if(visited.count(i) == 0){ possibilities.insert({getCost(pos,i),i}); } } for(auto i : possibilities){ // cout << i.first << " " << i.second << endl; // cout << pos << " " << i.second << " " << cost+i.first << endl; dfs(n,i.second,visited,cost+i.first); } } long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { // cout << endl; S=s;T=t; int n = (int) s.size(); unordered_set<int> visited; for(int i=0;i<n;i++){ dfs(n,i,visited,0); } return ans; }

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

railroad.cpp: In function 'void dfs(int, int, std::unordered_set<int>, long long int)':
railroad.cpp:26:23: warning: comparison of integer expressions of different signedness: 'std::unordered_set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |     if(visited.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...