Submission #1167254

#TimeUsernameProblemLanguageResultExecution timeMemory
1167254adriannokTravelling Merchant (APIO17_merchant)C++20
0 / 100
15 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; } int64_t maxProfit = 0; for(int k = 0; k < K; ++k) for(int i = 1; i < N; ++i) { 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:32: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=]
   32 |                         scanf("%lld %lld", &mrkt[0], &mrkt[1]);
      |                                ~~~^
      |                                   |
      |                                   long long int*
      |                                %ld
merchant.cpp:32: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=]
   32 |                         scanf("%lld %lld", &mrkt[0], &mrkt[1]);
      |                                     ~~~^
      |                                        |
      |                                        long long int*
      |                                     %ld
merchant.cpp:51:20: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type 'int64_t' {aka 'long int'} [-Wformat=]
   51 |         printf("%lld", maxProfit);
      |                 ~~~^   ~~~~~~~~~
      |                    |   |
      |                    |   int64_t {aka long int}
      |                    long long int
      |                 %ld
merchant.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |         scanf("%d %d %d", &N, &M, &K);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
merchant.cpp:32:30: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |                         scanf("%lld %lld", &mrkt[0], &mrkt[1]);
      |                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
merchant.cpp:36:35: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |                 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...