제출 #869845

#제출 시각아이디문제언어결과실행 시간메모리
869845gutzzy여행하는 상인 (APIO17_merchant)C++14
0 / 100
42 ms1236 KiB
#include <bits/stdc++.h> using namespace std; vector<vector<pair<int,int>>> items; vector<vector<int>> dist; int n; void fw(){ for(int k=0;k<n;k++){ for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]); } } } } int main(){ int m,k,v,w,t; cin >> n >> m >> k; // items --> vector[market][item][0-->buy / 1-->sell] items = vector<vector<pair<int,int>>>(n,vector<pair<int,int>>(k)); dist = vector<vector<int>>(n,vector<int>(n,1e18)); for(int i=0;i<n;i++) dist[i][i]=0; for(int i=0;i<n;i++){ for(int j=0;j<k;j++){ cin >> items[i][j].first >> items[i][j].second; } } for(int i=0;i<m;i++){ cin >> v >> w >> t; dist[v-1][w-1]=min(dist[v-1][w-1],t); } // busco cíclos fw(); int res = 0; for(int j=0;j<k;j++){ if(items[0][j].first==-1) continue; for(int i=1;i<n;i++){ if(items[i][j].second==-1) continue; res = max(res, (items[i][j].second-items[0][j].first)/(dist[0][i]+dist[i][0])); } } cout << res << endl; }

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

merchant.cpp: In function 'int main()':
merchant.cpp:23:48: warning: overflow in conversion from 'double' to 'std::vector<int>::value_type' {aka 'int'} changes value from '1.0e+18' to '2147483647' [-Woverflow]
   23 |     dist = vector<vector<int>>(n,vector<int>(n,1e18));
      |                                                ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...