Submission #432680

# Submission time Handle Problem Language Result Execution time Memory
432680 2021-06-18T12:21:13 Z Ruba_K Stations (IOI20_stations) C++14
0 / 100
3000 ms 2097156 KB
#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std ;

int zft ;
const int N = 1e3 + 3 ;
vector<int> labels;
vector<int> adj[N];
void zftquestion(int u , int p  ){

    labels[u] = ++zft ;

    for(auto f : adj[u]){
        if(f != p)
            zftquestion(f , u);

    }


}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {

    labels.resize(n);
	 for(int i = 0 ; i < n - 1 ; i ++)
        adj[u[i]].push_back(v[i]) , adj[v[i]].push_back(u[i]);

     int st = 0;

     for(int i = 0 ; i < n ; i ++)
        if(adj[i].size() == 1)st = i ;

	zftquestion(st , -1);
	return labels;
}

int find_next_station(int s, int t,vector<int> c) {
    
    if(c.size() == 1)return c[0];

    if(s < t)return c[1];


	return c[0];
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:30:6: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   30 |      for(int i = 0 ; i < n ; i ++)
      |      ^~~
stations.cpp:33:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   33 |  zftquestion(st , -1);
      |  ^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1349 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3035 ms 504 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1623 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 930 ms 400 KB Output is correct
2 Runtime error 1177 ms 2097156 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2863 ms 2097156 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -