답안 #563204

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
563204 2022-05-16T13:44:47 Z WKYH 밀림 점프 (APIO21_jumps) C++14
8 / 100
4000 ms 164756 KB
#include<bits/stdc++.h>
#define qc ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rt return
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef long double ld;
const long long mod=1e9+7;
const long long inf=INT_MAX;
using namespace std;
ll gcd(ll a,ll b){if(b==0)rt a;rt gcd(b,a%b);}

int n;
vector<vector<int>>gph;
void init(int N,vector<int>h)
{
    n=N;
    gph.resize(n,vector<int>(2,-1));
    for(int i=0;i<n;i++){
        if(gph[i][0]==-1){
            bool tkn=0;
            for(int j=i-1;j>=0;j--){
                if(h[j]>h[i]){
                    gph[i][0]=j;
                    break;
                }
                else{
                    if(tkn)continue;
                    gph[j][1]=i;
                    tkn=1;
                }
            }
        }
        if(gph[i][1]==-1){
            bool tkn=0;
            for(int j=i+1;j<n;j++){
                if(h[j]>h[i]){
                    gph[i][1]=j;
                    break;
                }
                else{
                    if(tkn)continue;
                    gph[j][0]=i;
                    tkn=1;
                }
            }
        }
    }
    rt;
}
int minimum_jumps(int a,int b,int c,int d)
{
    queue<pair<int,int>>q; // num,ind
    vector<bool>vis(n,false);
    for(int i=a;i<=b;i++)q.push({0,i});
    while(!q.empty()){
        int x=q.front().first, y=q.front().second;
        q.pop();
        vis[y]=true;
        if(y>=c&&y<=d)rt x;
        for(auto c:gph[y]){
            if(c==-1)continue;
            if(!vis[c])q.push({x+1,c});
        }
    }
    rt -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Execution timed out 4074 ms 10140 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 2 ms 208 KB Output is correct
6 Correct 2 ms 308 KB Output is correct
7 Correct 2 ms 208 KB Output is correct
8 Correct 2 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 2 ms 308 KB Output is correct
11 Correct 4 ms 208 KB Output is correct
12 Correct 2 ms 208 KB Output is correct
13 Correct 3 ms 208 KB Output is correct
14 Correct 3 ms 208 KB Output is correct
15 Correct 3 ms 208 KB Output is correct
16 Correct 10 ms 336 KB Output is correct
17 Correct 3 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 3 ms 208 KB Output is correct
21 Correct 3 ms 208 KB Output is correct
22 Correct 3 ms 208 KB Output is correct
23 Correct 5 ms 208 KB Output is correct
24 Correct 3 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 0 ms 208 KB Output is correct
27 Correct 1 ms 208 KB Output is correct
28 Correct 2 ms 208 KB Output is correct
29 Correct 3 ms 208 KB Output is correct
30 Correct 2 ms 208 KB Output is correct
31 Correct 5 ms 208 KB Output is correct
32 Correct 3 ms 208 KB Output is correct
33 Correct 0 ms 208 KB Output is correct
34 Correct 0 ms 236 KB Output is correct
35 Correct 1 ms 208 KB Output is correct
36 Correct 1 ms 208 KB Output is correct
37 Correct 0 ms 208 KB Output is correct
38 Correct 1 ms 208 KB Output is correct
39 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 2 ms 208 KB Output is correct
6 Correct 2 ms 308 KB Output is correct
7 Correct 2 ms 208 KB Output is correct
8 Correct 2 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 2 ms 308 KB Output is correct
11 Correct 4 ms 208 KB Output is correct
12 Correct 2 ms 208 KB Output is correct
13 Correct 3 ms 208 KB Output is correct
14 Correct 3 ms 208 KB Output is correct
15 Correct 3 ms 208 KB Output is correct
16 Correct 10 ms 336 KB Output is correct
17 Correct 3 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 3 ms 208 KB Output is correct
21 Correct 3 ms 208 KB Output is correct
22 Correct 3 ms 208 KB Output is correct
23 Correct 5 ms 208 KB Output is correct
24 Correct 3 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 0 ms 208 KB Output is correct
27 Correct 1 ms 208 KB Output is correct
28 Correct 2 ms 208 KB Output is correct
29 Correct 3 ms 208 KB Output is correct
30 Correct 2 ms 208 KB Output is correct
31 Correct 5 ms 208 KB Output is correct
32 Correct 3 ms 208 KB Output is correct
33 Correct 0 ms 208 KB Output is correct
34 Correct 0 ms 236 KB Output is correct
35 Correct 1 ms 208 KB Output is correct
36 Correct 1 ms 208 KB Output is correct
37 Correct 0 ms 208 KB Output is correct
38 Correct 1 ms 208 KB Output is correct
39 Correct 1 ms 208 KB Output is correct
40 Correct 0 ms 208 KB Output is correct
41 Correct 0 ms 208 KB Output is correct
42 Correct 0 ms 208 KB Output is correct
43 Correct 0 ms 208 KB Output is correct
44 Correct 2 ms 208 KB Output is correct
45 Correct 2 ms 208 KB Output is correct
46 Correct 2 ms 208 KB Output is correct
47 Correct 2 ms 208 KB Output is correct
48 Correct 1 ms 208 KB Output is correct
49 Correct 2 ms 208 KB Output is correct
50 Correct 3 ms 208 KB Output is correct
51 Correct 3 ms 208 KB Output is correct
52 Correct 3 ms 208 KB Output is correct
53 Correct 2 ms 208 KB Output is correct
54 Correct 3 ms 208 KB Output is correct
55 Correct 9 ms 388 KB Output is correct
56 Correct 3 ms 208 KB Output is correct
57 Correct 0 ms 208 KB Output is correct
58 Correct 34 ms 336 KB Output is correct
59 Correct 51 ms 336 KB Output is correct
60 Correct 10 ms 336 KB Output is correct
61 Correct 52 ms 428 KB Output is correct
62 Correct 14 ms 208 KB Output is correct
63 Correct 48 ms 336 KB Output is correct
64 Correct 70 ms 336 KB Output is correct
65 Correct 57 ms 432 KB Output is correct
66 Correct 731 ms 424 KB Output is correct
67 Correct 47 ms 336 KB Output is correct
68 Correct 705 ms 428 KB Output is correct
69 Execution timed out 4081 ms 164756 KB Time limit exceeded
70 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 37 ms 10376 KB Output is correct
6 Correct 45 ms 12712 KB Output is correct
7 Correct 27 ms 6600 KB Output is correct
8 Correct 51 ms 13560 KB Output is correct
9 Correct 7 ms 2196 KB Output is correct
10 Correct 47 ms 12696 KB Output is correct
11 Execution timed out 4037 ms 12744 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 277 ms 5924 KB Output is correct
5 Correct 1180 ms 12704 KB Output is correct
6 Correct 643 ms 2352 KB Output is correct
7 Correct 1169 ms 12712 KB Output is correct
8 Correct 589 ms 4560 KB Output is correct
9 Correct 1075 ms 12700 KB Output is correct
10 Execution timed out 4027 ms 12744 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 277 ms 5924 KB Output is correct
5 Correct 1180 ms 12704 KB Output is correct
6 Correct 643 ms 2352 KB Output is correct
7 Correct 1169 ms 12712 KB Output is correct
8 Correct 589 ms 4560 KB Output is correct
9 Correct 1075 ms 12700 KB Output is correct
10 Execution timed out 4027 ms 12744 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Execution timed out 4074 ms 10140 KB Time limit exceeded
4 Halted 0 ms 0 KB -