Submission #517111

# Submission time Handle Problem Language Result Execution time Memory
517111 2022-01-22T14:41:29 Z Sirapetch Stations (IOI20_stations) C++14
0 / 100
441 ms 512 KB
#include <bits/stdc++.h>
using namespace std;

vector <int> path[1111];
stack <int> walk;
int pass[1111],ty[1111],st[1111];
vector <int> la;

vector <int> label(int n, int k, vector<int> u, vector<int> v)
{
    la.clear();
    int i,x,y;
    for(i=0;i<n;i++)
    {
        pass[i]=0;
        ty[i]=0;
        la.push_back(0);
        path[i].clear();
    }
    x=u.size();
    for(i=0;i<x;i++)
    {
        path[u[i]].push_back(v[i]);
        path[v[i]].push_back(u[i]);
    }
    for(i=0;i<n;i++)
    {
        if(path[i].size()!=1)
        {
            pass[i]=1;
            break;
        }
    }
    la[i]=0;
    x=1;
    y=1;
    for(auto a:path[i])
    {
        st[y]=x;
        walk.push(a);
        while(!walk.empty())
        {
            i=walk.top();
            walk.pop();
            if(pass[i]==1) continue;
            pass[i]=1;
            la[i]=x;
            ty[x]=y;
            x++;
            for(auto a:path[i])
            {
                if(pass[a]==1) continue;
                walk.push(a);
            }
        }
        y++;
    }
    return la;
}

int find_next_station(int s, int t, vector<int> c)
{
    if(ty[s]==0)
    {
        return st[ty[t]];
    }
    if(ty[s]==ty[t])
    {
        if(s<t) return s+1;
        else return s-1;
    }
    if(s==st[ty[s]]) return 0;
    else return s-1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 320 KB Invalid labels (duplicates values). scenario=4, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 441 ms 512 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 328 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB Invalid labels (duplicates values). scenario=0, label=0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 316 KB Invalid labels (duplicates values). scenario=3, label=0
2 Halted 0 ms 0 KB -