Submission #1047456

#TimeUsernameProblemLanguageResultExecution timeMemory
1047456SN0WM4N밀림 점프 (APIO21_jumps)C++14
0 / 100
4088 ms3528 KiB
#include "jumps.h" #include <bits/stdc++.h> using namespace std; vector<int> v; vector<int> m_sig; void init(int N, std::vector<int> H) { v = H; m_sig.resize(N); int mx = 1e9, idx = -1; for (int i = N - 1; i >= 0; i --) { m_sig[i] = i; for (int j = i; j < N; j ++) { if (H[j] > H[i]) { m_sig[i] = j; break; } } } } int minimum_jumps(int A, int B, int C, int D) { int res = 1e9; for (int i = A; i <= B; i ++) { int ans = 0, idx = i; while (idx < C) { ans ++; if (idx == m_sig[idx]) break; idx = m_sig[idx]; } if (C <= idx && idx <= D) res = min(res, ans); } if (res == 1e9) res = -1; return res; }

Compilation message (stderr)

jumps.cpp: In function 'void init(int, std::vector<int>)':
jumps.cpp:13:13: warning: unused variable 'mx' [-Wunused-variable]
   13 |         int mx = 1e9, idx = -1;
      |             ^~
jumps.cpp:13:23: warning: unused variable 'idx' [-Wunused-variable]
   13 |         int mx = 1e9, idx = -1;
      |                       ^~~
#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...