Submission #1167259

#TimeUsernameProblemLanguageResultExecution timeMemory
1167259adriannokTravelling Merchant (APIO17_merchant)C++20
12 / 100
17 ms5952 KiB
#include <bits/stdc++.h> #define sooth true #define untrue false using namespace std; const int INF = 1e9 * 2; int N, M, K; vector< vector< vector<int64_t> > > market; vector< vector<int64_t> > d; void washifloi_Init() { 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][j], d[i][k] + d[k][j]); } int main(void) { scanf("%d %d %d", &N, &M, &K); market.resize(N, vector< vector<int64_t> >(K, vector<int64_t>(2))); d.resize( N, vector<int64_t>(N, INF) ); for (vector< vector<int64_t> > &vmrkt : market) for(vector<int64_t> &mrkt : vmrkt) scanf("%lld %lld", &mrkt[0], &mrkt[1]); for (int i = 0; i < M; ++i) { int u, v, t; scanf("%d %d %d", &u, &v, &t); d[u-1][v-1] = t; } washifloi_Init(); int64_t maxProfit = 0; for(int k = 0; k < K; ++k) for(int i = 1; i < N; ++i) { if ( -1 == market[i][k][1] || -1 == market[0][k][0] ) continue; int64_t length = d[0][i] + d[i][0]; int64_t profit = market[i][k][1] - market[0][k][0]; maxProfit = max( maxProfit, profit/length ); } printf("%lld", maxProfit); return 0; }

Compilation message (stderr)

merchant.cpp: In function 'int main()':
merchant.cpp:31:35: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type*' {aka 'long int*'} [-Wformat=]
   31 |                         scanf("%lld %lld", &mrkt[0], &mrkt[1]);
      |                                ~~~^
      |                                   |
      |                                   long long int*
      |                                %ld
merchant.cpp:31:40: warning: format '%lld' expects argument of type 'long long int*', but argument 3 has type '__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type*' {aka 'long int*'} [-Wformat=]
   31 |                         scanf("%lld %lld", &mrkt[0], &mrkt[1]);
      |                                     ~~~^
      |                                        |
      |                                        long long int*
      |                                     %ld
merchant.cpp:54:20: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'int64_t' {aka 'long int'} [-Wformat=]
   54 |         printf("%lld", maxProfit);
      |                 ~~~^   ~~~~~~~~~
      |                    |   |
      |                    |   int64_t {aka long int}
      |                    long long int
      |                 %ld
merchant.cpp:24:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         scanf("%d %d %d", &N, &M, &K);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
merchant.cpp:31:30: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |                         scanf("%lld %lld", &mrkt[0], &mrkt[1]);
      |                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
merchant.cpp:35:35: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |                 int u, v, t; scanf("%d %d %d", &u, &v, &t);
      |                              ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...