Submission #707259

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7072592023-03-08 17:31:44lto5Relay Marathon (NOI20_relaymarathon)C++14
100 / 100
1433 ms129216 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int64_t INF = 0x3f3f3f3f3f3f3f3f;
template <typename T>
bool minimize(T& a, T b) {
if (a > b) {
return a = b, 1;
}
return 0;
}
int n, m, k;
vector<pair<int, int>> g[N];
int spec[N];
tuple<int64_t, int, int> best_pair() {
vector<int64_t> d(n + 1, INF);
vector<int> head(n + 1, 0);
priority_queue<pair<int64_t, int>, vector<pair<int64_t, int>>, greater<pair<int64_t, int>>> pq;
for (int i = 1; i <= n; i++) {
if (spec[i]) {
head[i] = i;
d[i] = 0;
pq.emplace(d[i], i);
}
}
while (!pq.empty()) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

RelayMarathon.cpp: In function 'std::tuple<long int, int, int> best_pair()':
RelayMarathon.cpp:31:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   31 |     auto [du, u] = pq.top();
      |          ^
RelayMarathon.cpp:36:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   36 |     for (auto [v, w] : g[u]) {
      |               ^
RelayMarathon.cpp:47:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   47 |     for (auto [v, w] : g[u]) {
      |               ^
RelayMarathon.cpp: In function 'std::pair<long int, int> nearest_spec(int)':
RelayMarathon.cpp:66:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   66 |     auto [du, u] = pq.top();
      |          ^
RelayMarathon.cpp:74:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   74 |     for (auto [v, w] : g[u]) {
      |               ^
RelayMarathon.cpp: In function 'int main()':
RelayMarathon.cpp:112:8: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
  112 |   auto [min_d, x, y] = best_pair();
      |        ^
RelayMarathon.cpp:117:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
  117 |     auto [second_min_d, z, t] = best_pair();
      |          ^
RelayMarathon.cpp:122:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
  122 |     auto [nearest_a, z] = nearest_spec(x);
      |          ^
RelayMarathon.cpp:124:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
  124 |     auto [nearest_b, t] = nearest_spec(y);
      |          ^
RelayMarathon.cpp:129:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
  129 |     auto [nearest_a, z] = nearest_spec(y);
      |          ^
RelayMarathon.cpp:131:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
  131 |     auto [nearest_b, t] = nearest_spec(x);
      |          ^
RelayMarathon.cpp:90:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   90 |     freopen(task ".inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
RelayMarathon.cpp:91:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   91 |     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...