# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
979425 | 2024-05-10T23:48:11 Z | vjudge1 | 밀림 점프 (APIO21_jumps) | C++17 | 129 ms | 57732 KB |
#include "jumps.h" #include <bits/stdc++.h> using namespace std; vector<int>adj[200100]; int vis[200100],d[200100],n,h[200100],rbj[200100][18],obj[200100][18]; void init(int N, std::vector<int> H) { stack<int> stk; for(int i=0;i<N;i++) h[i+1]=H[i]; h[0]=1e9; n=N; for(int i=0;i<N;i++){ while(stk.size()&&H[stk.top()]<=H[i]) stk.pop(); if(stk.size()) adj[i+1].push_back(stk.top()+1); stk.push(i); } while(stk.size())stk.pop(); for(int i=N;i--;){ while(stk.size()&&H[stk.top()]<=H[i]) stk.pop(); if(stk.size()) adj[i+1].push_back(stk.top()+1), rbj[i+1][0]=stk.top()+1; stk.push(i); } for(int i=1;i<=N;i++)if(adj[i].size()>1) obj[i][0]=adj[i][H[adj[i][0]]>H[adj[i][1]]]; else if(adj[i].size()) obj[i][0]=adj[i][0]; for(int j=1;1<<j<N;j++) for(int i=1;i<=N;i++) rbj[i][j]=rbj[rbj[i][j-1]][j-1], obj[i][j]=obj[obj[i][j-1]][j-1]; } int minimum_jumps(int A, int B, int C, int D) { A=B; A++,C++; if(h[A]>=h[C]) return -1; int a=A,c=C,d=0; for(int i=17;i--;) if(h[rbj[a][i]]<=h[c]) a=rbj[a][i]; if(a-c) return -1; a=A; for(int i=17;i--;) if(h[obj[a][i]]<=h[c]) a=obj[a][i],d+=1<<i; for(int i=17;i--;) if(h[rbj[a][i]]<=h[c]) a=rbj[a][i],d+=1<<i; if(d!=C-A) return h[20000000]; return d; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 10840 KB | Output is correct |
2 | Correct | 2 ms | 10840 KB | Output is correct |
3 | Incorrect | 129 ms | 42360 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 10840 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 10840 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 10840 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 10840 KB | Output is correct |
2 | Correct | 2 ms | 8792 KB | Output is correct |
3 | Correct | 2 ms | 8628 KB | Output is correct |
4 | Runtime error | 51 ms | 57732 KB | Execution killed with signal 11 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 10840 KB | Output is correct |
2 | Correct | 2 ms | 8792 KB | Output is correct |
3 | Correct | 2 ms | 8628 KB | Output is correct |
4 | Runtime error | 51 ms | 57732 KB | Execution killed with signal 11 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 10840 KB | Output is correct |
2 | Correct | 2 ms | 10840 KB | Output is correct |
3 | Incorrect | 129 ms | 42360 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |