Submission #433087

# Submission time Handle Problem Language Result Execution time Memory
433087 2021-06-18T20:33:55 Z Ruba_K Stations (IOI20_stations) C++14
0 / 100
6 ms 732 KB
#include "stations.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std ;


const int N = 1e3 + 3 ;
vector<int> adj[N];

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
    vector<int> labels(n);
    // clear
    for(int i = 0 ; i < n - 1 ; i ++){
        adj[u[i]].push_back(v[i]);
        adj[v[i]].push_back(u[i]);


    }

    for(int i = 0 ; i < n ; i ++){

        string s = "" ;

        for(auto f : adj[i])s.push_back(f + 48);

        s.push_back(i + 48);

        while(s.size() < 8)s.insert(0 , "9");

        labels[i] = stoi(s);

    }




	return labels;
}

int find_next_station(int s, int t,vector<int> c) {


     for(auto f : c){

        map<int , int > mp ;

        int tmp  ;
        tmp = t ;


        while(tmp){


            mp[tmp % 10] ++ ;

            tmp /= 10;
        }
             mp.erase(9);

        tmp = f ;

        while(tmp){
            if(mp.count(tmp % 10) && tmp % 10 != s % 10){
                    return f ;
            }

            tmp /= 10 ;

        }




     }



	return c[0];
}
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 688 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 684 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 732 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 560 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 692 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -