Submission #433083

# Submission time Handle Problem Language Result Execution time Memory
433083 2021-06-18T20:27:38 Z Ruba_K Stations (IOI20_stations) C++14
0 / 100
6 ms 820 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))return f ;

            tmp /= 10 ;

        }




     }



	return c[0];
}
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 708 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 820 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 776 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 4 ms 576 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -