Submission #1064071

# Submission time Handle Problem Language Result Execution time Memory
1064071 2024-08-18T08:58:12 Z new_acc Stations (IOI20_stations) C++14
0 / 100
1 ms 852 KB
#include "stations.h"
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
const int N=1e3+10;
vi graf[N];
int val[N],li,kol[N];
void dfs(int v,int o){
    li++;
    if(!kol[v]) val[v]=li;
    for(auto u:graf[v]){
        if(u==o) continue;
        kol[u]=kol[v]^1;
        dfs(u,v);
    }
    li++;
    if(kol[v]) val[v]=li;
}
vi label(int n, int k, vi u,vi v) {
    for(int i=0;i<n;i++)
        graf[u[i]].push_back(v[i]),graf[v[i]].push_back(u[i]);
    dfs(0,0);
    vector<pair<int,int>> pom;
    for(int i=0;i<n;i++) pom.push_back({val[i],i});
    sort(pom.begin(),pom.end());
    vi labels(n);
    for(int i=0;i<n;i++) labels[pom[i].se]=i;
    for(int i=0;i<n;i++) graf[i].clear();
    pom.clear();
    li=0;
    assert(false);
    return labels;
}

int find_next_station(int s,int t,vi c) {
    if(c.size()==1) return c[0];
    if(c[0]>s){
        // pre
        if(s==0){
            for(auto u:c){
                if(u>=t) return u;
            }
            return 0;
        }
        if(t>=s and t<=c[c.size()-2]){
            for(auto u:c){
                if(u>=t) return u;
            }
            return 0;
        }return c[c.size()-1];
    }else{
        if(t>c[0] and t<=s){
            int ost=0;
            for(int i=1;i<(int)c.size();i++){
                if(t>=c[i]) ost=c[i];
            }
            return ost;
        }else return c[0];
    }
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 852 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -