# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
22018 | mohammad_kilani | Jakarta Skyscrapers (APIO15_skyscraper) | C++14 | 389 ms | 113584 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int N = 30001;
bitset<N>vis[N];
int n,m;
vector< vector<int> > g;
int BFS(int s,int e){
queue<pair<int,pair<int,int > > > q;
q.push(make_pair(s,make_pair(g[s][0],0)));
vis[s][0] = true;
while(!q.empty()){
int node = q.front().first;
int jump = q.front().second.first;
int cost = q.front().second.second;
q.pop();
if(node == e)
return cost;
int si = g[node].size();
for(int i=0;i<=si;i++){
int newjump;
if(i == si)
newjump = jump;
else
newjump = g[node][i];
int newnode = node+newjump;
if(newnode >= 0 && newnode < n && !vis[newnode][newjump]){
vis[newnode][newjump] = true;
q.push(make_pair(newnode,make_pair(newjump,cost+1)));
}
Compilation message (stderr)
# | 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... |