Submission #896713

#TimeUsernameProblemLanguageResultExecution timeMemory
896713IsamAutobus (COCI22_autobus)C++17
15 / 70
1058 ms12808 KiB
#include<bits/stdc++.h> using namespace std; constexpr int sz = 1e5 + 53243; constexpr int inf = 1e9 + 7; int n, m, K, Q; int dp[200][200][200]; signed main(){ ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n >> m; for(register int i = 1; i <= 71; ++i){ for(register int j = i; j <= 71; ++j){ for(register int l = 0; l < 100; ++l) dp[i][j][l] = dp[j][i][l] = inf; } } for(register int i = 1; i <= n; ++i) dp[i][i][0] = 0; for(register int i = 1, a, b, t; i <= m; ++i){ cin >> a >> b >> t; dp[a][b][1] = min(dp[a][b][1], t); } cin >> K >> Q; for(register int k = 0; k < 100; ++k){ for(register int i = 1; i <= n; ++i){ for(register int j = 1; j <= n; ++j){ for(register int l = 1; l <= n; ++l){ for(register int r = 0; r <= k; ++r){ if(dp[i][l][r] != inf && dp[l][j][k - r] != inf) dp[i][j][k] = min(dp[i][j][k], dp[i][l][r] + dp[l][j][k - r]); } } } } } int u, v; while(Q--){ cin >> u >> v; int ans = inf; for(register int i = 0; i < min(K + 1, 100); ++i){ ans = min(ans, dp[u][v][i]); } cout << (ans == inf ? -1 : ans) << '\n'; } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:13:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   13 |  for(register int i = 1; i <= 71; ++i){
      |                   ^
Main.cpp:14:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   14 |   for(register int j = i; j <= 71; ++j){
      |                    ^
Main.cpp:15:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   15 |    for(register int l = 0; l < 100; ++l) dp[i][j][l] = dp[j][i][l] = inf;
      |                     ^
Main.cpp:18:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   18 |  for(register int i = 1; i <= n; ++i) dp[i][i][0] = 0;
      |                   ^
Main.cpp:19:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |  for(register int i = 1, a, b, t; i <= m; ++i){
      |                   ^
Main.cpp:19:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |  for(register int i = 1, a, b, t; i <= m; ++i){
      |                          ^
Main.cpp:19:29: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |  for(register int i = 1, a, b, t; i <= m; ++i){
      |                             ^
Main.cpp:19:32: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   19 |  for(register int i = 1, a, b, t; i <= m; ++i){
      |                                ^
Main.cpp:25:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   25 |  for(register int k = 0; k < 100; ++k){
      |                   ^
Main.cpp:26:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   26 |   for(register int i = 1; i <= n; ++i){
      |                    ^
Main.cpp:27:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   27 |    for(register int j = 1; j <= n; ++j){
      |                     ^
Main.cpp:28:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   28 |     for(register int l = 1; l <= n; ++l){
      |                      ^
Main.cpp:29:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   29 |      for(register int r = 0; r <= k; ++r){
      |                       ^
Main.cpp:43:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   43 |   for(register int i = 0; i < min(K + 1, 100); ++i){
      |                    ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...