Submission #1264423

#TimeUsernameProblemLanguageResultExecution timeMemory
1264423minggaToll (BOI17_toll)C++20
17 / 100
1624 ms4616 KiB
// Author: caption_mingle #include "bits/stdc++.h" using namespace std; #define ln "\n" #define pb push_back #define fi first #define se second #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) #define ll long long const int mod = 1e9 + 7; const int inf = 2e9; const int N = 50005; int k, n, m, q; ll f[N]; vector<pair<int, int>> g[N]; signed main() { cin.tie(0) -> sync_with_stdio(0); #define task "" if(fopen(task ".INP", "r")) { freopen(task ".INP", "r", stdin); freopen(task ".OUT", "w", stdout); } cin >> k >> n >> m >> q; for(int i = 1; i <= m; i++) { int a, b, t; cin >> a >> b >> t; g[b].pb({a, t}); } for(int i = 1; i <= q; i++) { int a, b; cin >> a >> b; for(int j = 1; j <= n; j++) f[j] = 2e18; f[a] = 0; for(int j = a + 1; j <= b; j++) { for(auto [v, w] : g[j]) { f[j] = min(f[j], f[v] + w); } } if(f[b] == 2e18) f[b] = -1; cout << f[b] << ln; } cerr << "\nTime: " << clock() * 1000 / CLOCKS_PER_SEC; }

Compilation message (stderr)

toll.cpp: In function 'int main()':
toll.cpp:25:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |                 freopen(task ".INP", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
toll.cpp:26:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |                 freopen(task ".OUT", "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...
#Verdict Execution timeMemoryGrader output
Fetching results...