이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "jumps.h"
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define INF 10000000
#define MOD 1000000007
#define MID ((l+r)/2)
#define HASHMOD 2305843009213693951
#define ll long long
#define ull unsigned long long
#define F first
#define S second
typedef pair<ll, ll> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef map<int, int> mii;
#define EPS 1e-6
#define FOR(i,n) for(int i=0;i<((int)(n));i++)
#define FORi(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define FOA(v, a) for(auto v : a)
int t, n;
vi a, b;
void init(int N, std::vector<int> H) {
n = N;
a.resize(n);
FOR(i,n) a[i] = H[i];
}
int minimum_jumps(int A, int B, int C, int D) {
queue<int> q;
vi vis(n+1, false);
FORi(i,A,B+1) q.push(i), vis[i] = true;
q.push(-1);
int ans=0;
bool f = false;
while(q.size()>1){
int t = q.front();
q.pop();
if(t==-1){
ans++;
q.push(-1);
continue;
}
if(C<=t && t<=D){
f = true;
break;
}
FORi(i,t+1,n){
if(!vis[i] && a[i]>a[t]){
vis[i] = true;
q.push(i);
break;
}
}
FORi(i,1,t+1){
if(!vis[t-i] && a[t-i]>a[t]){
vis[t-i] = true;
q.push(t-i);
break;
}
}
}
if(f) return ans;
else return -1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |