제출 #786736

#제출 시각아이디문제언어결과실행 시간메모리
786736mindiyakRoller Coaster Railroad (IOI16_railroad)C++14
컴파일 에러
0 ms0 KiB
#include "railroad.h" #include <iostream> #include <unordered_set> #define ll long long using namespace std; const int MAXN = (2*1e5)+2; // const int MAXN = 100; int costTable[MAXN][MAXN]; long long ans = 1e18; 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; } for(int i=0;i<n;i++){ if(visited.count(i) == 0){ dfs(n,i,visited,cost+costTable[pos][i]); } } } long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n = (int) s.size(); for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(j==i){ costTable[i][j] = 0; }else{ // cout << i << " " << j << " " << t[i] << " " << s[i] << " " << t[j] << " " << s[j] << endl; costTable[i][j] = max(0,t[i]-s[j]); } } } // cout << endl; // for(int i=0;i<n;i++){ // for(int j=0;j<n;j++){ // cout << costTable[i][j] << " "; // }cout << endl; // } 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:20:23: warning: comparison of integer expressions of different signedness: 'std::unordered_set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(visited.size() == n){
      |        ~~~~~~~~~~~~~~~^~~~
/tmp/ccou0tQA.o: in function `_GLOBAL__sub_I_costTable':
railroad.cpp:(.text.startup+0xb): relocation truncated to fit: R_X86_64_PC32 against `.bss'
railroad.cpp:(.text.startup+0x29): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(vterminate.o): in function `__gnu_cxx::__verbose_terminate_handler()':
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x1e): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
(.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x2b): relocation truncated to fit: R_X86_64_PC32 against `.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating'
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status