제출 #774380

#제출 시각아이디문제언어결과실행 시간메모리
774380vjudge1여행하는 상인 (APIO17_merchant)C++17
12 / 100
15 ms3148 KiB
#include <bits/stdc++.h>
#define ve vector
#define vi vector<int>
#define vii vector<ii>
#define ii pair<int,int>
#define fi first
#define se second
#define ll long long
#define INF 1e18+7
#define pb push_back
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag,
    tree_order_statistics_node_update>;
const int MOD = 1e9+7;
const int nax = 100+5;
const int kax = 1005;
void readio(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

ll b[nax][kax], s[nax][kax], d[nax][nax];
ve<pair<int,ll>> adj[nax];
short vis[nax];
int main()
{
    optimise;
    int n,m,k;
    cin >> n >> m >> k;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            d[i][j] = INF;
        }
        for (int j = 0; j < k; ++j)
        {
            cin >> b[i][j] >> s[i][j];
        }
    }
    for (int i = 0; i < m; ++i)
    {
        int a,b,c;
        cin >> a >> b >> c;
        a--,b--;
        adj[a].pb({b,c});
        d[a][b] = c;
    }
    for (int k = 0; k < n; ++k)
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < n; ++j)
                d[i][j] = min(d[i][k]+d[k][j], d[i][j]);
    ll ans = 0;
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < k; ++j)
        {
            if(b[0][j] != -1 && s[i][j] != -1){
                ans = max(ans, (s[i][j]-b[0][j])/(d[0][i]+d[i][0])); 
            }
        }
    }
    cout << ans << endl;
}

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

merchant.cpp: In function 'void readio()':
merchant.cpp:23:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
merchant.cpp:24:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...