제출 #200332

#제출 시각아이디문제언어결과실행 시간메모리
200332Rakhmand여행하는 상인 (APIO17_merchant)C++14
12 / 100
28 ms2168 KiB
// // ROIGold.cpp // Main calisma // // Created by Rakhman on 05/02/2019. // Copyright © 2019 Rakhman. All rights reserved. // #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <cstring> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <queue> #include <cmath> #include <cstdlib> #include <ctime> #include <cassert> #include <iterator> #define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0); #define S second #define F first #define pb push_back #define nl '\n' #define NL cout << '\n'; #define EX exit(0) #define all(s) s.begin(), s.end() #define FOR(i, start, finish, k) for(int i = start; i <= finish; i += k) const int MXN = 1e5 + 10; const long long MNN = 1e6 + 200; const long long MOD = 1e9 + 7; const long long INF = 1e18; const int OO = 1e9 + 10; typedef long long llong; typedef unsigned long long ullong; using namespace std; void istxt(bool yes){ if(yes == 1){ freopen("balancing.in", "r", stdin); freopen("balancing.out", "w", stdout); }else{ freopen("/Users/rakhmanabdirashov/Desktop/folder/Programming/Road2Master/Road2Master/input.txt", "r", stdin); } } int n, m, k; llong b[110][1100], s[110][1100]; llong g[110][110]; llong mx[110][110]; //pair<llong, llong> dp[110]; int main () { ios; //istxt(0); cin >> n >> m >> k; for(int i = 1; i <= n; i++){ for(int j = 1; j <= k; j++){ cin >> b[i][j] >> s[i][j]; } } for(int i = 1; i <= n; i++){ for(int j = 1; j <= n; j++){ g[i][j] = INF; } g[i][i] = 0; } for(int i = 1; i <= m; i++){ int u, v, cost; cin >> u >> v >> cost; g[u][v] = cost; } for(int k = 1; k <= n; k++){ for(int i = 1; i <= n; i++){ for(int j = 1; j <= n; j++){ g[i][j] = min(g[i][j], g[i][k] + g[k][j]); } } } // for(int i = 1; i <= n; i++){ // for(int j = 1; j <= n; j++){ // cout << g[i][j] << ' '; // } // cout << nl; // } // cout << nl; for(int i = 1; i <= n; i++){ for(int j = 1; j <= k; j++){ if(b[i][j] != -1){ for(int nx = 1; nx <= n; nx++){ if(i == nx) continue; if(s[nx][j] != -1 && g[i][nx] != OO){ //cout << i << ' ' << nx << ' ' << j << nl; //cout << (s[nx][j] - b[i][j]) / g[i][nx] << ' '<< b[i][j] << ' ' << s[nx][j] << ' ' << g[i][nx]<< nl; mx[i][nx] = max(mx[i][nx], s[nx][j] - b[i][j]); } } } } } llong ans = 0; for(int i = 1; i <= n; i++){ for(int j = 1; j <= n; j++){ if(i != j) ans = max(ans, (mx[i][j] + mx[j][i]) / (g[i][j] + g[j][i])); } } cout << ans; }

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

merchant.cpp:9:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
 #pragma comment(linker, "/stack:200000000")
 
merchant.cpp: In function 'void istxt(bool)':
merchant.cpp:59:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         freopen("balancing.in", "r", stdin);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
merchant.cpp:60:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         freopen("balancing.out", "w", stdout);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
merchant.cpp:62:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
         freopen("/Users/rakhmanabdirashov/Desktop/folder/Programming/Road2Master/Road2Master/input.txt", "r", stdin);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...