Problem:
Problem E:
Reverse a Road
Andrew R. Klein resides in the city of Yanwoe, and goes to his working place in this city every weekday.
He has been totally annoyed with the road traffic of this city. All the roads in this city are one-way, so he
has to drive a longer way than he thinks he need.
One day, the following thought has come up to Andrew’s mind: “How about making the sign of one road
indicate the opposite direction? I think my act won’t be out as long as I change just one sign. Well, of
course I want to make my route to the working place shorter as much as possible. Which road should I
alter the direction of?” What a clever guy he is.
You are asked by Andrew to write a program that finds the shortest route when the direction of up to
one road is allowed to be altered. You don’t have to worry about the penalty for complicity, because you
resides in a different country from Andrew and cannot be punished by the law of his country. So just help
him!
Input
The input consists of a series of datasets, each of which is formatted as follows:
N
S T
M
A
1
B
1
A
2
B
2
...
A
M
B
M
N
denotes the number of points.
S
and
T
indicate the points where Andrew’s home and working place are
located respectively.
M
denotes the number of roads. Finally,
A
i
and
B
i
indicate the starting and ending
points of the
i
-th road respectively. Each point is identified by a unique number from 1 to
N
. Some roads
may start and end at the same point. Also, there may be more than one road connecting the same pair of
starting and ending points.
You may assume all the following: 1 ≤
N
≤ 1000, 1 ≤
M
≤ 10000, and
S
≠
T
.
The input is terminated by a line that contains a single zero. This is not part of any dataset, and hence
should not be processed.
Output
For each dataset, print a line that contains the shortest distance (counted by the number of passed roads)
and the road number whose direction should be altered. If there are multiple ways to obtain the shortest
distance, choose one with the smallest road number. If no direction change results in a shorter route, print
0 as the road number.
Separate the distance and the road number by a single space. No extra characters are allowed.
Sample Input
4
1 4
4
1 2
2 3
3 4
4 1
0
Output for the Sample Input
1 4

Submitted solutions:

code_snippet: #include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
#define rep(i, m, n) for (ll i = (ll)m; i < (ll)n; i++)
#define drep(i, m, n) for (ll i = m - 1; i >= n; i--)
#define Endl endl
#define all(a) a.begin(), a.end()
#define pr(i, j) make_pair(i, j)
#define isin(x, l, r) (l <= x && x < r)
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
#define srt(ar) sort(ar.begin(), ar.end())
#define rev(ar) reverse(ar.begin(), ar.end())
#define jge(f, s, t) cout << (f ? s : t) << endl
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#define printar(ar)             \
    do                          \
    {                           \
        for (auto dbg : ar)     \
        {                       \
            cout << dbg << " "; \
        }                       \
        cout << endl;           \
    } while (0)
const ll inf = 1e18;
const ld pi = 3.14159265358979;
const ld eps = 1e-9;
template <class T, ll n, ll idx = 0>
auto make_vec(const ll (&d)[n], const T &init) noexcept
{
    if constexpr (idx < n)
        return std::vector(d[idx], make_vec<T, n, idx + 1>(d, init));
    else
        return init;
}

template <class T, ll n>
auto make_vec(const ll (&d)[n]) noexcept
{
    return make_vec(d, T{});
}
//////////////// 以下を貼る ////////////////
template <class T>
size_t HashCombine(const size_t seed, const T &v)
{
    return seed ^ (std::hash<T>()(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2));
}
/* pair用 */
template <class T, class S>
struct std::hash<std::pair<T, S>>
{
    size_t operator()(const std::pair<T, S> &keyval) const noexcept
    {
        return HashCombine(std::hash<T>()(keyval.first), keyval.second);
    }
};
////////////////////////////////////////////
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    while (true)
    {
        ll n;
        cin >> n;
        if (n == 0)
        {
            break;
        }
        ll s, t;
        cin >> s >> t;
        s--;
        t--;
        ll m;
        cin >> m;
        vector<ll> a(m), b(m);
        rep(i, 0, m)
        {
            cin >> a[i] >> b[i];
            a[i]--;
            b[i]--;
        }
        ll sub = inf;
        ll ans = -1;
        rep(i, -1, m)
        {
            vector<vector<ll>> g(n);
            rep(j, 0, m)
            {
                if (i != j)
                {
                    g[a[j]].push_back(b[j]);
                }
                else
                {
                    g[b[j]].push_back(a[j]);
                }
            }
            vector<ll> d(n, inf);
            priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> que;
            d[s] = 0;
            que.push(pr(0, s));
            while (!que.empty())
            {
                ll now = que.top().second;
                ll D = que.top().first;
                que.pop();
                if (d[now] != D)
                {
                    continue;
                }
                rep(j, 0, g[now].size())
                {
                    ll nxt = g[now][j];
                    if (d[nxt] > d[now] + 1)
                    {
                        d[nxt] = d[now] + 1;
                        que.push(pr(d[nxt], nxt));
                    }
                }
            }
            if (sub > d[t])
            {
                sub = d[t];
                ans = i;
            }
        }
        cout << sub << " " << ans + 1 << endl;
    }
}
accuracy: 1
time_ms: 6520
memory_kb: 3968
final_rank: 18

code_snippet: #include <cstdio>

#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

const int MAXN = 100005;
const int INF = 1e9;

int n, m, S, T, dis1[MAXN], dis2[MAXN];
vector<int> G[MAXN], G_rev[MAXN];

void shortest_path(vector<int> G[], int dis[], int st) {
    priority_queue<pair<int, int>> pq;

    fill(dis + 1, dis + n + 1, INF);
    dis[st] = 0;
    pq.push({0, st});
    while (!pq.empty()) {
        int d = pq.top().first, u = pq.top().second;
        pq.pop();
        if (d > dis[u]) continue;
        for (auto v : G[u]) {
            if (dis[v] > dis[u] + 1) {
                dis[v] = dis[u] + 1;
                pq.push({dis[v], v});
            }
        }
    }
}

int main() {
    while (scanf("%d", &n) != EOF) {
        if (n == 0) break;
        for (int i = 1; i <= n; i++) {
            G[i].clear();
            G_rev[i].clear();
        }

        scanf("%d%d", &S, &T);
        scanf("%d", &m);
        vector<pair<int, int>> edges;
        for (int i = 1, u, v; i <= m; i++) {
            scanf("%d%d", &u, &v);
            G[u].push_back(v);
            G_rev[v].push_back(u);
            edges.push_back({u, v});
        }
        shortest_path(G, dis1, S);
        shortest_path(G_rev, dis2, T);
        int mn = dis1[T], mne = 0;
        for (int i = 0; i < edges.size(); i++) {
            int u = edges[i].first, v = edges[i].second;
            if (mn > dis1[v] + dis2[u] + 1) {
                mn = dis1[v] + dis2[u] + 1;
                mne = i + 1;
            }
        }
        printf("%d %d\n", mn, mne);
    }
    return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 7692
final_rank: 17

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int INF = 10101010;

int main(){
    int n;
    while(cin >>n,n){
        int s,t;
        cin >>s >>t;
        --s;
        --t;

        vector<vector<int>> G(n),rG(n);

        auto add_edge = [&](int u, int v){
            G[u].pb(v);
            rG[v].pb(u);
        };

        int m;
        cin >>m;
        vector<int> a(m),b(m);
        rep(i,m){
            cin >>a[i] >>b[i];
            --a[i];
            --b[i];
            add_edge(a[i],b[i]);
        }

        auto BFS = [&](int start, vector<vector<int>>g){
            vector<int> d(n,INF);
            d[start] = 0;
            queue<int> que({start});
            while(!que.empty()){
                int v = que.front();
                que.pop();
                for(int e:g[v]){
                    if(d[e] > d[v]+1){
                        d[e] = d[v]+1;
                        que.push(e);
                    }
                }
            }
            return d;
        };

        vector<int> ds = BFS(s,G), dt = BFS(t,rG);

        int eidx = -1;
        int ans = ds[t];
        rep(i,m){
            int dd = ds[b[i]] + 1 + dt[a[i]];
            if(ans > dd){
                ans = dd;
                eidx = i;
            }
        }

        cout << ans << " " << eidx+1 << "\n";
    }
    return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 3304
final_rank: 5

code_snippet: #include "bits/stdc++.h"

#pragma warning(disable:4996)
using namespace std;
using ld = long double;
namespace treap {
	struct node {
		int prior, sz, dp, add;
		node *l, *r;
		node(int x) {
			prior = (rand() << 15) | rand();
			// sz = 1;
			dp = x;
			l = r = NULL;
			add = 0;
		}
	};

	typedef node * pnode;

	void push(node* T) {
		T->dp += T->add;
		if (T->l)
			T->l->add += T->add;
		if (T->r)
			T->r->add += T->add;
		T->add = 0;
	}

	node* merge(node * L, node * R) {
		if (!L) {
			return R;
		}
		if (!R) {
			return L;
		}
		if (L->prior > R->prior) {
			push(L);
			L->r = merge(L->r, R);
			return L;
		}
		else {

			push(R);
			R->l = merge(L, R->l);
			return R;

		}
	}

	pair<node*,node*> split(pnode T, int value) {
		if (!T) {
			return make_pair(nullptr,nullptr);
		}
		push(T);
		if (T->dp >= value) {
			auto p=split(T->l, value);
			T->l=p.second;
			return make_pair(p.first,T);
		}
		else {

			auto p = split(T->r, value);
			T->r = p.first;
			return make_pair(T, p.second);
		}
	}

	int findBegin(pnode T) {
		push(T);
		if (!T->l)
			return T->dp;
		return findBegin(T->l);
	}

	int findMax(pnode T, int n) {
		if (!T)
			return 0;
		push(T);
		return findMax(T->l, n) + findMax(T->r, n) + (T->dp <= 1e9 ? 1 : 0);
	}


}
#include<random>

vector<int>dfs(const vector<vector<int>>&edges, const int start) {
	vector<int>memo(edges.size(),1e9);
	memo[start]=0;
	queue<int>que;
	que.emplace(start);
	while (!que.empty()) {
		const int now=que.front();
		que.pop();
		for (auto e : edges[now]) {
			if (memo[e] > memo[now] + 1) {
				memo[e]=memo[now]+1;
				que.emplace(e);
			}
		}
	}
	return memo;
}

int main() {
	int N;
	while (cin >> N,N) {


		int S, T; cin >> S >> T;
		S--; T--;
		int M; cin >> M;
		vector<vector<int>>edges(N);
		vector<vector<int>>rev_edges(N);
		map<pair<int, int>, int>mp;
		for (int i = 0; i < M; ++i) {
			int a, b; cin >> a >> b;
			a--; b--;
			rev_edges[b].push_back(a);
			edges[a].push_back(b);
			if(mp.find(make_pair(a,b))==mp.end())mp[make_pair(a, b)] = i;
		}
		vector<int>from_ss = dfs(edges, S);
		vector<int>from_ts = dfs(rev_edges, T);

		pair<int, int>answer = make_pair(from_ss[T], -1);
		for (auto m : mp) {
			auto i = m.first.first;
			auto e = m.first.second;
			int sum = 1 + from_ss[e] + from_ts[i];
			answer = min(answer, make_pair(sum,m.second));

		}
		cout << answer.first << " " << answer.second+1 << endl;

	}
	return 0;
}
accuracy: 1
time_ms: 30
memory_kb: 3928
final_rank: 10

code_snippet: #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Info{
	void set(int arg_from,int arg_to,int arg_id){
		from = arg_from;
		to = arg_to;
		id = arg_id;
	}
	int from,to,id;
};

struct Data{
	Data(int arg_node_id,int arg_total_cost){
		node_id = arg_node_id;
		total_cost = arg_total_cost;
	}
	bool operator<(const struct Data &arg) const{
		return total_cost > arg.total_cost;
	}
	int node_id,total_cost;
};

bool check[1000][1000];
Info info[10000];
int N,M,start,goal,min_dist[1000],rev_min_dist[1000];
vector<int> V[1000],rev_V[1000];


void func(){

	scanf("%d %d",&start,&goal);
	start--;
	goal--;

	for(int i = 0; i < N; i++){
		V[i].clear();
		rev_V[i].clear();
		for(int k = 0; k < N; k++)check[i][k] = false;
	}

	scanf("%d",&M);

	int tmp_from,tmp_to,index = 0;

	for(int loop = 0; loop < M; loop++){
		scanf("%d %d",&tmp_from,&tmp_to);
		tmp_from--;
		tmp_to--;
		if(check[tmp_from][tmp_to] == false){
			check[tmp_from][tmp_to] = true;
			info[index].set(tmp_from,tmp_to,loop+1);
			V[tmp_from].push_back(tmp_to);
			rev_V[tmp_to].push_back(tmp_from);
			index++;
		}
	}

	for(int i = 0; i < N; i++)min_dist[i] = BIG_NUM;

	min_dist[start] = 0;

	priority_queue<Data> Q;
	Q.push(Data(start,0));

	int minimum1 = BIG_NUM;

	while(!Q.empty()){

		if(Q.top().node_id == goal){
			minimum1 = min(minimum1,Q.top().total_cost);
			Q.pop();
		}else if(Q.top().total_cost > min_dist[Q.top().node_id]){
			Q.pop();
		}else{

			for(int i = 0; i < V[Q.top().node_id].size(); i++){

				if(min_dist[V[Q.top().node_id][i]] > Q.top().total_cost+1){
					min_dist[V[Q.top().node_id][i]] = Q.top().total_cost+1;
					Q.push(Data(V[Q.top().node_id][i],min_dist[V[Q.top().node_id][i]]));
				}
			}
			Q.pop();
		}
	}

	for(int i = 0; i < N; i++)rev_min_dist[i] = BIG_NUM;
	rev_min_dist[goal] = 0;
	Q.push(Data(goal,0));

	while(!Q.empty()){

		if(Q.top().node_id == start){
			Q.pop();
		}else if(Q.top().total_cost > rev_min_dist[Q.top().node_id]){
			Q.pop();
		}else{

			for(int i = 0; i < rev_V[Q.top().node_id].size(); i++){

				if(rev_min_dist[rev_V[Q.top().node_id][i]] > Q.top().total_cost+1){
					rev_min_dist[rev_V[Q.top().node_id][i]] = Q.top().total_cost+1;
					Q.push(Data(rev_V[Q.top().node_id][i],Q.top().total_cost+1));
				}
			}
			Q.pop();
		}
	}

	int minimum2 = BIG_NUM,road_id;
	for(int i = 0; i < index; i++){
		if(min_dist[info[i].from] > min_dist[info[i].to]){
			if(min_dist[info[i].to]+rev_min_dist[info[i].from]+1 < minimum2){
				minimum2 = min_dist[info[i].to]+rev_min_dist[info[i].from]+1;
				road_id = info[i].id;
			}
		}
	}

	if(minimum1 <= minimum2){
		printf("%d %d\n",minimum1,0);
	}else{
		printf("%d %d\n",minimum2,road_id);
	}
}

int main(){

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 4580
final_rank: 12

code_snippet: #include<bits/stdc++.h>
#define N 1000
#define mk make_pair
#define fi first
#define se second
using namespace std;
typedef pair<int,int> P;
int main(){
  int n;
  while(cin>>n,n){
    vector<pair<int,int> >g[1000],rg[1000];
    int s,t,m;
    cin>>s>>t;
    s--;t--;
    cin>>m;
    for(int i=0;i<m;i++){
      int a,b;
      cin>>a>>b;
      a--;b--;
      g[a].push_back(P(b, i+1));
      rg[b].push_back(P(a, i+1));
    }
    pair<int,int> d[n][2];
    memset(d,-1,sizeof(d));
    for(int i=0;i<n;i++)
      for(int j=0;j<2;j++) d[i][j] = P(1e9,1e9);
    d[s][0]=mk(0,0);
    queue<pair<int,int> >q;
    q.push(mk(s,0));
    while(!q.empty()){
      pair<int,int>p=q.front();q.pop();
      int v=p.fi,used=p.se;
      int cost=d[v][used].fi;
      int edge=d[v][used].se;
       for(int i=0;i<g[v].size();i++){
     int nx=g[v][i].fi;
     P ncost = P(cost+1,edge);
     if(d[nx][used]>ncost ){
       d[nx][used]=ncost;
       q.push(mk(nx,used));
        }
       }
        if(!used)for(int i=0;i<rg[v].size();i++){
        int nx=rg[v][i].fi;
        P ncost = P(cost+1,rg[v][i].se);
      if(d[ nx ][1]>ncost){
        d[nx][1]=ncost;
        q.push(mk(nx,1));
      }
     }
    }
    P ans=min(d[t][0],d[t][1]);
    cout<<ans.fi<<' '<<ans.se<<endl;
  }
}
accuracy: 1
time_ms: 20
memory_kb: 3300
final_rank: 4

code_snippet: #include<bits/stdc++.h>
#define MAX 1005
#define INF 123456789
using namespace std;
struct edge{int to;int cost;};
typedef pair<int,int> P;
int V;
vector<edge> G[MAX];
int d[MAX];
void dkstr(int s){
  priority_queue<P,vector<P>,greater<P> >que;
  fill(d,d+V,INF);
  d[s]=0;
  que.push(P(0,s));
  while(!que.empty()){
    P p=que.top();que.pop();
    int v=p.second;
    if(d[v]<p.first)continue;
    for(int i=0;i<G[v].size();i++){
      edge e = G[v][i];
      if(d[e.to]>d[v]+e.cost){
	d[e.to]=d[v]+e.cost;
	//cout << d[e.to]<< endl;
	que.push(P(d[e.to],e.to));
      }
    }
  }
}
    
int main(){
  while(1){
    for(int i=0;i<MAX;i++){
      G[i].clear();
    }
    int s,g,m;
    int mp=0;
    cin >> V ;
    if(V==0)break;
    cin >> s >> g >> m;
    s--;
    g--;
    vector<P> ed(m);
    for(int i=0;i<m;i++){
      int b,e;
      cin >> b >> e;
      b--;
      e--;
      ed[i].first=b;
      ed[i].second=e;
      
      edge bu;
      bu.to=e;
      bu.cost=1;
      G[b].push_back(bu);
    }

    dkstr(s);
    int ma=d[g];
    //cout << ma << endl;
    int od[MAX];
    for(int i=0;i<MAX;i++){
      od[i]=d[i];
    }

    for(int i=0;i<m;i++){
      if(od[ed[i].second]<od[ed[i].first]){
	G[ed[i].second].push_back({ed[i].first,1});
	dkstr(s);
	int maa=ma;
	ma=min(ma,d[g]);
	if(maa!=ma){
	  mp=i+1;
	}
	G[ed[i].second].pop_back();
      }
    }
    cout << ma << " " << mp << endl;
  }
  return 0;
}
accuracy: 1
time_ms: 890
memory_kb: 3348
final_rank: 11

code_snippet: #include<bits/stdc++.h>
#define N 1000
#define mk make_pair
#define fi first
#define se second
using namespace std;
typedef pair<int,int> P;
int main(){

  int n;

  while(cin>>n,n){
    vector<pair<int,int> >g[1000],rg[1000];
    int s,t,m;
    cin>>s>>t;
    s--;t--;

    cin>>m;

    for(int i=0;i<m;i++){
      int a,b;
      cin>>a>>b;
      a--;b--;
      g[a].push_back(P(b, i+1));
      rg[b].push_back(P(a, i+1));
    }
   
    pair<int,int> d[n][2];
    memset(d,-1,sizeof(d));
    for(int i=0;i<n;i++)
      for(int j=0;j<2;j++) d[i][j] = P(1e9,1e9);
    d[s][0]=mk(0,0);

    queue<pair<int,int> >q;

    q.push(mk(s,0));

    while(!q.empty()){
      pair<int,int>p=q.front();q.pop();
      int v=p.fi,used=p.se;
      int cost=d[v][used].fi;
      int edge=d[v][used].se;
      
       for(int i=0;i<g[v].size();i++){
	 int nx=g[v][i].fi;
	 P ncost = P(cost+1,edge);
	 if(d[nx][used]>ncost ){
	   d[nx][used]=ncost;
	   q.push(mk(nx,used));
       	}
       }

      	if(!used)for(int i=0;i<rg[v].size();i++){
	    int nx=rg[v][i].fi;
	    P ncost = P(cost+1,rg[v][i].se);
	  if(d[ nx ][1]>ncost){
	    d[nx][1]=ncost;
	    q.push(mk(nx,1));
	  }
	 }
    }

    P ans=min(d[t][0],d[t][1]);

    cout<<ans.fi<<' '<<ans.se<<endl;
  }
}
accuracy: 1
time_ms: 20
memory_kb: 3368
final_rank: 7

code_snippet: #include<bits/stdc++.h>
using namespace std;

typedef pair<int,int> P;
P mem[1111][2];
vector<P> G[1111];
vector<P> rG[1111];
int N,M;

struct state {
  int id,f,c,e;
  state(){}
  state(int id,int f,int c,int e=-1):id(id),f(f),c(c),e(e){}
  bool operator<(const state& p) const {
    if( c == p.c ) return e > p.e;
    return c > p.c;
  }
};

void init(){
  fill(mem[0],mem[N+1],P((1<<29),-1));
  for(int i=0;i<N;i++) G[i].clear();
  for(int i=0;i<N;i++) rG[i].clear();
}

P solve(int s,int t){
  priority_queue<state> q;
  q.emplace(s,0,0);
  mem[s][0] = P(0,0);
  while( !q.empty() ){
    state p = q.top(); q.pop();
    // cout << p.id << " "<< p.f << " "<< p.c << " "<< p.e << endl;
    if( mem[p.id][p.f] < P(p.c,p.e) ) continue;
    P np = P(p.c + 1, p.e);    
    for( P e : G[p.id] ){
      //cout << " -> " << e.first << " " << p.f << endl;
      if( mem[e.first][p.f] > np ){
        mem[e.first][p.f] = np;
        q.emplace( e.first, p.f, np.first, np.second );
      }
    }
    if( p.f ) continue;
    for( P e : rG[p.id] ){
      np = P(p.c+1,e.second);
      //cout << "R -> " << e.first << " " << 1 << endl;
      if( mem[e.first][1] > np ){
        mem[e.first][1] = np;
        q.emplace( e.first, 1, np.first, np.second );
      }
    }
  }
  //cout << mem[t][0].first << " "<< mem[t][0].second << endl;
  //cout << mem[t][1].first << " "<< mem[t][1].second << endl;
  if( mem[t][0] < mem[t][1] )
    return mem[t][0];
  else
    return mem[t][1];
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  while( cin >> N && N ){
    init();
    int s,t; cin >> s >> t; --s; --t;
    cin >> M;
    for(int i=0;i<M;i++){
      int a,b; cin >> a >> b; --a; --b;
      G[a].emplace_back( b, i );
      rG[b].emplace_back( a, i );
    }
    
    P res = solve(s,t);
    cout << res.first << " " << res.second+1 << endl;
  }

}
accuracy: 1
time_ms: 10
memory_kb: 3740
final_rank: 9

code_snippet: #include <queue>
#include <vector>
#include <iostream>
using namespace std;
struct edge {
	int to, cost, id;
};
struct state {
	int pos, cost, used, id;
};
int N, M, s, t, a, b;
int main() {
	while (cin >> N, N) {
		cin >> s >> t >> M; s--, t--;
		vector<vector<edge> > G(N);
		for (int i = 0; i < M; i++) {
			cin >> a >> b; a--, b--;
			G[a].push_back({ b, 0, i });
			G[b].push_back({ a, 1, i });
		}
		vector<vector<pair<int, int> > > d(N, vector<pair<int, int> >(2, make_pair(999999999, -1)));
		queue<state> que; que.push(state{ s, 0, 0, -1 }); d[s][0] = make_pair(0, -1);
		while (!que.empty()) {
			state u = que.front(); que.pop();
			for (edge e : G[u.pos]) {
				pair<int, int> f = d[u.pos][u.used];
				f.first += 1;
				int z = u.used + e.cost;
				if (e.cost) f.second = e.id;
				if (z == 2) continue;
				if (d[e.to][z] > f) {
					d[e.to][z] = f;
					que.push(state{ e.to, f.first, z, f.second });
				}
			}
		}
		if (d[t][0].first <= d[t][1].first) cout << d[t][0].first << ' ' << 0 << endl;
		else cout << d[t][1].first << ' ' << d[t][1].second + 1 << endl;
	}
	return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 3340
final_rank: 6

code_snippet: #include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef pair<int,int>P;

vector<int>E[1000];
int d[1000][1000];
int main() {
	int n;
	while(scanf("%d",&n),n){
		rep(i,n)E[i].clear();
		int s,t,m;scanf("%d%d%d",&s,&t,&m);s--;t--;
		vector<P>v;
		rep(i,m){
			int a,b;scanf("%d%d",&a,&b);a--;b--;
			v.push_back(P(a,b));
			E[a].push_back(b);
		}
		memset(d,0x3f,sizeof(d));
		rep(i,n){
			queue<int>que;
			d[i][i]=0;que.push(i);
			while(!que.empty()){
				int p=que.front();que.pop();
				for(int v:E[p]){
					if(d[i][v]==INF){
						d[i][v]=d[i][p]+1;que.push(v);
					}
				}
			}
		}
		int Min=d[s][t],id=0;
		rep(i,m){
			int a=d[s][v[i].second]+1+d[v[i].first][t];
			if(Min>a){
				Min=a;id=i+1;
			}
		}
		printf("%d %d\n",Min,id);
	}
}
accuracy: 1
time_ms: 80
memory_kb: 7332
final_rank: 16

code_snippet: #include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 1011
#define INF 1e9
 
struct Edge{
    int u,v;
};
 
vector<int> G[MAX];
 
int bfs(int s,int t){
    queue<int> Q;
    Q.push(s);
    int dist[MAX];
    fill(dist,dist+MAX,INF);
    dist[s] = 0;
   
    while(!Q.empty()){
	int v = Q.front(); Q.pop();
	if(v == t) return dist[t];
	for(int i = 0 ; i < (int)G[v].size() ; i++){
	    if(dist[v] + 1 < dist[G[v][i]]){
		dist[G[v][i]] = dist[v] + 1;
		Q.push(G[v][i]);
	    }
	}
    }
    return INF;
}
 
int main(){
    int N,S,T,M;
    while(cin >> N,N){
	vector<Edge> e;
	cin >> S >> T >> M;
	S--; T--;
	for(int i = 0 ; i < MAX ; i++){
	    G[i].clear();
	}
	for(int i = 0 ; i < M ; i++){
	    int u,v;
	    cin >> u >> v;
	    u--; v--;
	    e.push_back((Edge){u,v});
	    G[u].push_back(v);
	}
	int res,nc,num;
	res = nc = bfs(S,T);
	for(int i = 0 ; i < (int)e.size() ; i++){
	    for(int j = 0 ; j < N ; j++){
		G[j].clear();
	    }
	    swap(e[i].u,e[i].v);
	    for(int j = 0 ; j < (int)e.size() ; j++){
		G[e[j].u].push_back(e[j].v);
	    }
	    int r = bfs(S,T);
	    if(r < res){
		res = r;
		num = i+1;
	    }
	    swap(e[i].u,e[i].v);
	}
	if(res == nc){
	    cout << res << " " << 0 << endl;
	}else{
	    cout << res << " " << num << endl;
	}
    }
    return 0;
}
accuracy: 1
time_ms: 1450
memory_kb: 3304
final_rank: 13

code_snippet: #include <iostream>
using namespace std;

int main() {
	int N,S,T,M,s,e,best;
	while(true){
	cin>>N;
	if(N==0){
	break;
	}
	else{
		cin>>S>>T;
		cin>>M;
	int a[1000][1000];
	int b[10000][2];
	for (int k=0;k<N;k++){
		for (int l=0;l<N;l++){
			a[k][l]=1e7;
		}
		a[k][k]=0;
	}
	for (int k=0;k<M;k++){
		cin>>s>>e;
		b[k][0]=e-1;b[k][1]=s-1;
		a[s-1][e-1]=min(a[s-1][e-1],1);
	}
  	for (int i = 0; i < N; i++)      // ?????±????????????
    	for (int j = 0; j < N; j++)    // ????§???????
      		for (int k = 0; k < N; k++)  // ??????
        		a[j][k] = min(a[j][k], a[j][i] + a[i][k]);
	int ans=a[S-1][T-1];
	best=0;
	for (int k=0;k<M;k++){
		s=b[k][0];e=b[k][1];
		if (ans>a[S-1][s]+1+a[e][T-1]){
			ans=a[S-1][s]+1+a[e][T-1];
			best=k+1;
		}
	}
	cout<<ans<<" "<<best<<endl;
		/*
	for( int i=0; i<M; i++ ) {
	    delete[] b[i];
	}
	delete[] b;
	for( int i=0; i<N; i++ ) {
	    delete[] a[i];
	}
	delete[] a;
	}
		*/
	}
}
	return 0;
}
accuracy: 1
time_ms: 5560
memory_kb: 5148
final_rank: 19

code_snippet: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 1000;
const int MAX_M = 10000;

const int INF = 1 << 30;

/* typedef */

typedef pair<int,int> pii;

/* global variables */

int n, m;
int st, gl;
pii rds[MAX_M];
int rmtx[MAX_N][MAX_N], dmtx[MAX_N][MAX_N];
int dists[MAX_N];

/* subroutines */

int min_count() {
  for (int i = 0; i < n; i++) dists[i] = INF;
  dists[st] = 0;

  queue<int> q;
  q.push(st);

  while (! q.empty()) {
    int u = q.front(); q.pop();

    if (u == gl) break;
    int nvd = dists[u] + 1;
    
    for (int v = 0; v < n; v++)
      if (rmtx[u][v] && dists[v] >= INF) {
	dists[v] = nvd;
	q.push(v);
      }
  }

  return dists[gl];
}

/* main */

int main() {
  for (;;) {
    cin >> n;
    if (n == 0) break;

    cin >> st >> gl;
    st--, gl--;

    cin >> m;
    
    memset(rmtx, 0, sizeof(rmtx));
    
    for (int i = 0; i < m; i++) {
      int ai, bi;
      cin >> ai >> bi;
      ai--, bi--;
      rds[i] = pii(ai, bi);

      if (ai != bi) rmtx[ai][bi]++;
    }

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) dmtx[i][j] = INF;
      dmtx[i][i] = 0;
      queue<int> q;
      q.push(i);

      while (! q.empty()) {
	int u = q.front(); q.pop();
	int nvd = dmtx[i][u] + 1;
	for (int v = 0; v < n; v++)
	  if (rmtx[u][v] && dmtx[i][v] >= INF) {
	    dmtx[i][v] = nvd;
	    q.push(v);
	  }
      }
    }
    
    int min_c = min_count();
    int min_ri = -1;
    //cout << min_c << endl;

    for (int ri = 0; ri < m; ri++) {
      int ai = rds[ri].first;
      int bi = rds[ri].second;
      if (rmtx[ai][bi] == 0) continue;

      if (min_c > dmtx[st][bi] + 1 + dmtx[ai][gl]) {
	rmtx[ai][bi]--;
	rmtx[bi][ai]++;

	int c = min_count();
	if (min_c > c) {
	  min_c = c;
	  min_ri = ri;
	}

	rmtx[bi][ai]--;
	rmtx[ai][bi]++;
      }
    }

    printf("%d %d\n", min_c, min_ri + 1);
  }

  return 0;
}
accuracy: 1
time_ms: 2460
memory_kb: 9096
final_rank: 20

code_snippet: #include<stdio.h>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
vector<int>g[1100];
vector<pair<int,int> >rev[1100];
int bfs[1100][2];
int use[1100];
int v[1100][2];
int main(){
	int a;
	while(scanf("%d",&a),a){
		int b,c,d;scanf("%d%d%d",&b,&c,&d);
		b--;c--;
		for(int i=0;i<a;i++){
			bfs[i][0]=bfs[i][1]=999999999;
			v[i][0]=v[i][1]=0;
			use[i]=999999999;
			g[i].clear();rev[i].clear();
		}
		for(int i=0;i<d;i++){
			int p,q;scanf("%d%d",&p,&q);
			p--;q--;
			g[p].push_back(q);
			rev[q].push_back(make_pair(p,i+1));
		}
		priority_queue<pair<pair<int,int>,pair<int,int> > >Q;
		Q.push(make_pair(make_pair(0,0),make_pair(b,0)));
		bfs[b][0]=0;
		while(Q.size()){
			int cost=-Q.top().first.first;
			int num=-Q.top().first.second;
			int at=Q.top().second.first;
			int st=Q.top().second.second;
			Q.pop();
			for(int i=0;i<g[at].size();i++){
				if(bfs[g[at][i]][st]>cost+1||(st&&bfs[g[at][i]][st]==cost+1&&use[g[at][i]]>use[at])){
					bfs[g[at][i]][st]=bfs[at][st]+1;
					if(st)use[g[at][i]]=use[at];
					Q.push(make_pair(make_pair(-cost-1,-num),make_pair(g[at][i],st)));
				}
			}
			if(!st){
				for(int i=0;i<rev[at].size();i++){
					if(bfs[rev[at][i].first][1]>cost+1||(bfs[rev[at][i].first][1]==cost+1&&use[rev[at][i].first]>rev[at][i].second)){
						bfs[rev[at][i].first][1]=bfs[at][st]+1;
						use[rev[at][i].first]=rev[at][i].second;
						Q.push(make_pair(make_pair(-cost-1,-use[rev[at][i].first]),make_pair(rev[at][i].first,1)));
					}
				}
			}
		}
		if(bfs[c][0]<=bfs[c][1])printf("%d 0\n",bfs[c][0]);
		else printf("%d %d\n",bfs[c][1],use[c]);
	}
}
accuracy: 1
time_ms: 20
memory_kb: 1496
final_rank: 1

code_snippet: #include <bits/stdc++.h>

using namespace std;

#define MAX 1011
#define INF 1e9

struct Edge{
  int u,v;
};

vector<int> G[MAX];

int bfs(int s,int t){
  queue<int> Q;
  Q.push(s);
  int dist[MAX];
  fill(dist,dist+MAX,INF);
  dist[s] = 0;
  
  while(!Q.empty()){
    int v = Q.front(); Q.pop();
    if(v == t) return dist[t];
    for(int i = 0 ; i < (int)G[v].size() ; i++){
      if(dist[v] + 1 < dist[G[v][i]]){
        dist[G[v][i]] = dist[v] + 1;
        Q.push(G[v][i]);
      }
    }
  }
  return INF;
}

int main(){
  int N,S,T,M;
  while(cin >> N,N){
    vector<Edge> e;
    cin >> S >> T >> M;
    S--; T--;
    for(int i = 0 ; i < MAX ; i++){
      G[i].clear();
    }
    for(int i = 0 ; i < M ; i++){
      int u,v;
      cin >> u >> v;
      u--; v--;
      e.push_back((Edge){u,v});
      G[u].push_back(v);
    }
    int res,nc,num;
    res = nc = bfs(S,T);
    for(int i = 0 ; i < (int)e.size() ; i++){
      for(int j = 0 ; j < N ; j++){
        G[j].clear();
      }
      swap(e[i].u,e[i].v);
      for(int j = 0 ; j < (int)e.size() ; j++){
        G[e[j].u].push_back(e[j].v);
      }
      int r = bfs(S,T);
      if(r < res){
        res = r;
        num = i+1;
      }
      swap(e[i].u,e[i].v);
    }
    if(res == nc){
      cout << res << " " << 0 << endl;
    }else{
      cout << res << " " << num << endl;
    }
  }
  return 0;
}
accuracy: 1
time_ms: 1600
memory_kb: 1544
final_rank: 8

code_snippet: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 10;

struct state {
	int p, c, r;
	state(int p, int c, int r) : p(p), c(c), r(r) {};
	bool operator<(const state &o)const {
		return o.c<c;
	}
};

int main() {
	int N;
	while (cin >> N, N) {
		int S, T, M, A, B;
		vvi dist(N + 1, vi(N + 1, INF));
		cin >> S >> T >> M;
		int num = 1;
		REP(i, M) {
			cin >> A >> B;
			dist[A][B] = min(dist[A][B], num);
			num++;
		}

		priority_queue<state> Q;
		Q.push(state(S, 0, 0));
		vi ncost(N + 1, INF), rcost(N + 1, INF), road(N + 1, INF);
		int ans = INF, ansr = INF;
		while (!Q.empty()) {
			state st = Q.top();
			Q.pop();

			if (ans < st.c) {
				break;
			}

			if (st.p == T) {
				if (st.c < ans) {
					ans = st.c;
					ansr = st.r;
					continue;
				}
				else if (st.c == ans && st.r < ansr) {
					ansr = st.r;
					continue;
				}
			}

			FOR(i, 1, N) {
				if (dist[st.p][i] != INF) {
					if (st.r == 0) {
						if (st.c + 1 < ncost[i]) {
							ncost[i] = st.c + 1;
							Q.push(state(i, st.c + 1, 0));
						}
					}
					else  {
						if (st.c + 1 < rcost[i]) {
							rcost[i] = st.c + 1;
							road[i] = st.r;
							Q.push(state(i, st.c + 1, st.r));
						}
						else if (st.c + 1 == rcost[i] && st.r < road[i]) {
							road[i] = st.r;
							Q.push(state(i, st.c + 1, st.r));
						}
					}
				}
				if (dist[i][st.p] != INF && st.r == 0) {
					if (st.c + 1 < rcost[i]) {
						rcost[i] = st.c + 1;
						road[i] = dist[i][st.p];
						Q.push(state(i, st.c + 1, dist[i][st.p]));
					}
					else if (st.c + 1 == rcost[i] && st.r < road[i]) {
						road[i] = dist[i][st.p];
						Q.push(state(i, st.c + 1, dist[i][st.p]));
					}
				}
			}
		}

		cout << ans << " " << ansr << endl;
	}

	return 0;
}
accuracy: 1
time_ms: 120
memory_kb: 5172
final_rank: 14

code_snippet: #include<bits/stdc++.h>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define MAX 1010

using namespace std;

typedef pair<int,int> ii;

struct Edge{
  int to,index;
  Edge(int to=IINF,int index=IINF):to(to),index(index){}
};

struct Data{
  int cur,cost,rev;
  Data(int cur=IINF,int cost=IINF,int rev=IINF):cur(cur),cost(cost),rev(rev){}
  bool operator < (const Data& data)const{
    if( cost != data.cost ) return cost > data.cost;
    return rev > data.rev;
  }
};

int N,M,S,T,a,b;
vector<Edge> G[MAX][2];
ii mincost[MAX][2];

inline void dijkstra(){
  priority_queue<Data> Q;

  Q.push(Data(S,0,IINF));
  mincost[S][0] = ii(0,IINF);
  while(!Q.empty()){
    Data data = Q.top(); Q.pop();
    int cur = data.cur;
    bool r = (data.rev!=IINF);
    if( mincost[cur][r].first < data.cost ) continue;
    rep(j,2){
      if( j && r ) break;
      if( j )r = true;
      rep(i,(int)G[cur][j].size()){
        if( j )data.rev = G[cur][j][i].index;
        int to = G[cur][j][i].to;
        int ncost = data.cost + 1;
        if( mincost[to][r].first == ncost && r && data.rev < mincost[to][r].second ){
          mincost[to][r].second = data.rev;
          Q.push(Data(to,ncost,data.rev));
        } else if( mincost[to][r].first > ncost ){
          mincost[to][r] = ii(ncost,data.rev);
          Q.push(Data(to,ncost,data.rev));
        }
      }
    }
  }

  int answer_cost = min(mincost[T][0].first,mincost[T][1].first);
  int answer_rev = mincost[T][1].second;
  if( mincost[T][0].first <= mincost[T][1].first ) answer_rev = -1;
  cout << answer_cost << ' ' << answer_rev+1 << endl;
}

int main(){
  while(cin>>N,N){
    rep(i,N)rep(j,2)G[i][j].clear(),mincost[i][j] = ii(IINF,IINF);
    cin >> S >> T;
    --S, --T;
    cin >> M;
    rep(i,M){
      cin >> a >> b;
      --a,--b;
      G[a][0].push_back(Edge(b,i));
      G[b][1].push_back(Edge(a,i));
    }
    dijkstra();
  }
  return 0;
}
accuracy: 1
time_ms: 30
memory_kb: 1780
final_rank: 2

code_snippet: #include<bits/stdc++.h>

using namespace std;

struct Edge{int to, idx;};
struct State{
  int t, used, pos;
  bool operator < (const State& st) const{
    if(t != st.t) return t < st.t;
    return used < st.used;
  }
  
  bool operator > (const State& st) const {
    return st < *this;
  }
};

const int MAX = 1001;
const int INF = (1<<28);
State T[2][MAX];
int N;
vector<Edge> G[MAX], rG[MAX];

void solve(int from, int to){
  
  priority_queue<State, vector<State>, greater<State> > Q;
  Q.push((State){0, -1, from});
  T[0][from] = (State){0,-1,from};
  
  while(!Q.empty()){
    const State st = Q.top();
    Q.pop();

    const int used = (st.used==-1?0:1);
    if(T[used][st.pos] < st) continue;

    if(used==0){
      for(int i = 0; i < (int)rG[st.pos].size(); i++){
	State nex = st;
	nex.t++;
	nex.pos = rG[st.pos][i].to;
	nex.used = rG[st.pos][i].idx;
	if(nex < T[1][nex.pos]){
	  T[1][nex.pos] = nex;
	  Q.push(nex);
	}
      }
    }

    for(int i = 0; i < (int)G[st.pos].size(); i++){
      State nex = st;
      nex.t++;
      nex.pos = G[st.pos][i].to;
      if(nex < T[used][nex.pos]){
	T[used][nex.pos] = nex;
	Q.push(nex);
      }
    }      
  }
  
  State ans = min(T[0][to], T[1][to]);
  cout << ans.t << " " << ans.used+1 << endl;
}

void init(){
  for(int i = 0; i < 2; i++)
    for(int j = 0; j < MAX; j++) T[i][j] = (State){INF, INF, -1};
  for(int i = 0; i < MAX; i++){
    G[i].clear();
    rG[i].clear();
  }
}

int main(){
  
  while(cin >> N && N){
    init();
    int s,t;
    cin >> s >> t;
    int M;
    cin >> M;
    for(int i = 0; i < M; i++){
      int a, b;
      cin >> a >> b;
      a--; b--;
      G[a].push_back((Edge){b,i});
      rG[b].push_back((Edge){a,i});
    }
    solve(s-1,t-1);
  }
  return 0;
}
accuracy: 1
time_ms: 30
memory_kb: 1928
final_rank: 3

code_snippet: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-12;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

struct state {
	int p, c, r;
	state(int p, int c, int r) : p(p), c(c), r(r) {};
	bool operator<(const state &o)const {
		return o.c<c;
	}
};

int main() {
	int N;
	while(cin >> N, N) {
		int S, T, M, A, B;
		vvi dist(N+1, vi(N+1, INF));
		cin >> S >> T >> M;
		int num = 1;
		REP(i, M) {
			cin >> A >> B;
			dist[A][B] = min(dist[A][B], num);
			num++;
		}

		priority_queue<state> Q;
		Q.push(state(S, 0, 0));
		vi ncost(N+1, INF), rcost(N+1, INF), road(N+1, INF);
		int ans = INF, ansr = INF;
		while(!Q.empty()) {
			state st = Q.top();
			Q.pop();

			if(ans < st.c) {
				break;
			}

			if(st.p == T) {
				if(st.c < ans) {
					ans = st.c;
					ansr = st.r;
					continue;
				} else if(st.c == ans && st.r < ansr) {
					ansr = st.r;
					continue;
				}
			}

			FOR(i, 1, N) {
				if(dist[st.p][i] != INF) {
					if(st.r == 0) {
						if(st.c+1 < ncost[i]) {
							ncost[i] = st.c+1;
							Q.push(state(i, st.c+1, 0));
						}
					} else  {
						if(st.c+1 < rcost[i]) {
							rcost[i] = st.c+1;
							road[i] = st.r;
							Q.push(state(i, st.c+1, st.r));
						} else if(st.c+1 == rcost[i] && st.r < road[i]) {
							road[i] = st.r;
							Q.push(state(i, st.c+1, st.r));
						}
					}
				}
				if(dist[i][st.p] != INF && st.r == 0) {
					if(st.c+1 < rcost[i]) {
						rcost[i] = st.c+1;
						road[i] = dist[i][st.p];
						Q.push(state(i, st.c+1, dist[i][st.p]));
					} else if(st.c+1 == rcost[i] && st.r < road[i]) {
						road[i] = dist[i][st.p];
						Q.push(state(i, st.c+1, dist[i][st.p]));
					}
				}
			}
		}

		cout << ans << " " << ansr << endl;
	}	

	return 0;
}
accuracy: 1
time_ms: 120
memory_kb: 5172
final_rank: 14