제출 #1047477

#제출 시각아이디문제언어결과실행 시간메모리
1047477SN0WM4N밀림 점프 (APIO21_jumps)C++14
8 / 100
4086 ms4184 KiB
#include "jumps.h" #include <bits/stdc++.h> using namespace std; vector<int> v; vector<int> m_sig, m_prev; void init(int N, std::vector<int> H) { v = H; m_sig.resize(N); m_prev.resize(N); for (int i = N - 1; i >= 0; i --) { m_sig[i] = i; m_prev[i] = i; for (int j = i; j < N; j ++) { if (H[j] > H[i]) { m_sig[i] = j; break; } } for (int j = i; j >= 0; j --) { if (H[j] > H[i]) { m_prev[i] = j; break; } } } } int minimum_jumps(int A, int B, int C, int D) { int res = 1e9; for (int i = A; i <= B; i ++) { queue<pair<int, int>> q; q.push({i, 0}); vector<int> vis(v.size(), 1e9); int ans = 1e9; while (!q.empty()) { auto [x, d] = q.front(); q.pop(); if (vis[x] <= d) continue; if (C <= x && x <= D) { ans = d; break; } vis[x] = d; q.push({m_sig[x], d + 1}); q.push({m_prev[x], d + 1}); } res = min(res, ans); } if (res == 1e9) res = -1; return res; }

컴파일 시 표준 에러 (stderr) 메시지

jumps.cpp: In function 'int minimum_jumps(int, int, int, int)':
jumps.cpp:44:30: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   44 |                         auto [x, d] = q.front();
      |                              ^
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...