Submission #432700

# Submission time Handle Problem Language Result Execution time Memory
432700 2021-06-18T12:32:29 Z Ruba_K Stations (IOI20_stations) C++14
5 / 100
950 ms 640 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) {
    zft = 0 ;
    labels.clear();

    for(int i = 0 ; i < n ; i ++)
        adj[i].clear();

    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:35:6: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   35 |      for(int i = 0 ; i < n ; i ++)
      |      ^~~
stations.cpp:38:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   38 |  zftquestion(st , -1);
      |  ^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 501 ms 520 KB Output is correct
2 Correct 428 ms 508 KB Output is correct
3 Correct 846 ms 400 KB Output is correct
4 Correct 703 ms 528 KB Output is correct
5 Correct 543 ms 512 KB Output is correct
6 Correct 457 ms 612 KB Output is correct
7 Correct 455 ms 508 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 6 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 455 ms 512 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 529 ms 516 KB Output is correct
2 Correct 483 ms 528 KB Output is correct
3 Correct 853 ms 400 KB Output is correct
4 Correct 645 ms 512 KB Output is correct
5 Correct 623 ms 508 KB Output is correct
6 Correct 487 ms 604 KB Output is correct
7 Correct 421 ms 528 KB Output is correct
8 Correct 3 ms 448 KB Output is correct
9 Correct 6 ms 468 KB Output is correct
10 Correct 2 ms 460 KB Output is correct
11 Incorrect 640 ms 400 KB Wrong query response.
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 950 ms 400 KB Output is correct
2 Correct 693 ms 476 KB Output is correct
3 Correct 565 ms 400 KB Output is correct
4 Correct 2 ms 468 KB Output is correct
5 Correct 3 ms 472 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Incorrect 610 ms 520 KB Wrong query response.
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 538 ms 528 KB Output is correct
2 Correct 475 ms 500 KB Output is correct
3 Correct 914 ms 400 KB Output is correct
4 Correct 631 ms 404 KB Output is correct
5 Correct 623 ms 640 KB Output is correct
6 Correct 467 ms 612 KB Output is correct
7 Correct 430 ms 516 KB Output is correct
8 Correct 3 ms 468 KB Output is correct
9 Correct 5 ms 468 KB Output is correct
10 Correct 3 ms 468 KB Output is correct
11 Incorrect 441 ms 596 KB Wrong query response.
12 Halted 0 ms 0 KB -