Submission #1064061

# Submission time Handle Problem Language Result Execution time Memory
1064061 2024-08-18T08:55:01 Z new_acc Stations (IOI20_stations) C++14
0 / 100
3000 ms 2097152 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;
    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 1144 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3105 ms 1871384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1451 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 593 ms 684 KB Output is correct
2 Correct 482 ms 684 KB Output is correct
3 Correct 392 ms 684 KB Output is correct
4 Correct 1 ms 776 KB Output is correct
5 Runtime error 1178 ms 2097152 KB Execution killed with signal 9
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -