Submission #872179

# Submission time Handle Problem Language Result Execution time Memory
872179 2023-11-12T13:00:07 Z kitkat12 Stations (IOI20_stations) C++14
52.3205 / 100
541 ms 1480 KB
//Dedicated to my love,ivaziva
#include<bits/stdc++.h>
#include "stations.h"
using namespace std;
#define ll long long 
#define pb push_back 
const int maxn=1050;
const int mx=1000;
const int mod=998244353;  
vector<int> es[maxn]; //ivice
int tin[maxn],tout[maxn];
int vr=0;
void dfs(int u,int par){
    tin[u]=vr;vr++;
    for(auto e:es[u]){
        if(e!=par){
            dfs(e,u);
        }
    }
    tout[u]=vr-1;
}   
vector<int> label(int n,int k,vector<int> u,vector<int> v){
    vector<int> kodiraj(n,0);
    for(int i=0;i<n;i++) es[i].clear();
    for(int i=0;i<v.size();i++){
        es[u[i]].pb(v[i]);
        es[v[i]].pb(u[i]);
    } 
    vr=0;
    dfs(0,-1);
    for(int i=0;i<n;i++){
        kodiraj[i]=tin[i]*mx+tout[i];//tout[i]<=1k
    }
    return kodiraj;
}
int find_next_station(int s,int e,vector<int> c){
    int ine=e/mx,oute=e%mx;
    int ins=s/mx,outs=s%mx;
    if(ine>=ins&&outs>=oute){
        bool root=ins==0;
        for(int i=(root?0:1);i<c.size();i++){
            int ini=c[i]/1000,outi=c[i]%1000;
            if(ine>=ini&&outi>=oute) return c[i];
        }
    }
    return c[0];
}
// void sol(){      
    
// }
// int main(){
//     int T=1;
//     // scanf("%d",&T);
//     while(T--){
//         sol();
//     }
//     return 0;
// }

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:25:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int i=0;i<v.size();i++){
      |                 ~^~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:41:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         for(int i=(root?0:1);i<c.size();i++){
      |                              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 568 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6009
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 532 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1511
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 322 ms 912 KB Output is correct
2 Correct 261 ms 1056 KB Output is correct
3 Correct 526 ms 684 KB Output is correct
4 Correct 385 ms 684 KB Output is correct
5 Correct 358 ms 680 KB Output is correct
6 Correct 263 ms 904 KB Output is correct
7 Correct 243 ms 684 KB Output is correct
8 Correct 1 ms 764 KB Output is correct
9 Correct 1 ms 768 KB Output is correct
10 Correct 0 ms 768 KB Output is correct
11 Correct 329 ms 800 KB Output is correct
12 Correct 295 ms 1160 KB Output is correct
13 Correct 270 ms 1408 KB Output is correct
14 Correct 256 ms 684 KB Output is correct
15 Correct 29 ms 1120 KB Output is correct
16 Correct 39 ms 1108 KB Output is correct
17 Correct 64 ms 904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 500 ms 684 KB Output is correct
2 Correct 382 ms 684 KB Output is correct
3 Correct 342 ms 684 KB Output is correct
4 Correct 2 ms 768 KB Output is correct
5 Correct 2 ms 768 KB Output is correct
6 Correct 0 ms 768 KB Output is correct
7 Correct 354 ms 684 KB Output is correct
8 Correct 541 ms 940 KB Output is correct
9 Correct 398 ms 684 KB Output is correct
10 Correct 329 ms 684 KB Output is correct
11 Correct 3 ms 772 KB Output is correct
12 Correct 2 ms 768 KB Output is correct
13 Correct 2 ms 768 KB Output is correct
14 Correct 1 ms 768 KB Output is correct
15 Correct 0 ms 764 KB Output is correct
16 Correct 292 ms 684 KB Output is correct
17 Correct 280 ms 684 KB Output is correct
18 Correct 285 ms 684 KB Output is correct
19 Correct 294 ms 684 KB Output is correct
20 Correct 312 ms 684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 305 ms 908 KB Partially correct
2 Partially correct 248 ms 904 KB Partially correct
3 Partially correct 492 ms 684 KB Partially correct
4 Partially correct 382 ms 684 KB Partially correct
5 Partially correct 369 ms 684 KB Partially correct
6 Partially correct 255 ms 1056 KB Partially correct
7 Partially correct 267 ms 684 KB Partially correct
8 Partially correct 1 ms 768 KB Partially correct
9 Partially correct 2 ms 768 KB Partially correct
10 Partially correct 0 ms 772 KB Partially correct
11 Partially correct 275 ms 880 KB Partially correct
12 Partially correct 317 ms 844 KB Partially correct
13 Partially correct 512 ms 684 KB Partially correct
14 Partially correct 392 ms 684 KB Partially correct
15 Partially correct 328 ms 684 KB Partially correct
16 Partially correct 269 ms 684 KB Partially correct
17 Partially correct 354 ms 684 KB Partially correct
18 Partially correct 288 ms 1144 KB Partially correct
19 Partially correct 290 ms 1276 KB Partially correct
20 Partially correct 259 ms 684 KB Partially correct
21 Partially correct 34 ms 900 KB Partially correct
22 Partially correct 45 ms 844 KB Partially correct
23 Partially correct 66 ms 876 KB Partially correct
24 Partially correct 3 ms 768 KB Partially correct
25 Partially correct 2 ms 768 KB Partially correct
26 Partially correct 2 ms 768 KB Partially correct
27 Partially correct 1 ms 928 KB Partially correct
28 Partially correct 1 ms 768 KB Partially correct
29 Partially correct 311 ms 940 KB Partially correct
30 Partially correct 310 ms 684 KB Partially correct
31 Partially correct 322 ms 684 KB Partially correct
32 Partially correct 287 ms 684 KB Partially correct
33 Partially correct 284 ms 940 KB Partially correct
34 Partially correct 180 ms 904 KB Partially correct
35 Partially correct 261 ms 1428 KB Partially correct
36 Partially correct 255 ms 1152 KB Partially correct
37 Partially correct 282 ms 896 KB Partially correct
38 Partially correct 274 ms 1404 KB Partially correct
39 Partially correct 264 ms 1192 KB Partially correct
40 Partially correct 265 ms 1280 KB Partially correct
41 Partially correct 270 ms 1052 KB Partially correct
42 Partially correct 35 ms 900 KB Partially correct
43 Partially correct 62 ms 1160 KB Partially correct
44 Partially correct 73 ms 884 KB Partially correct
45 Partially correct 98 ms 896 KB Partially correct
46 Partially correct 183 ms 860 KB Partially correct
47 Partially correct 180 ms 888 KB Partially correct
48 Partially correct 32 ms 1480 KB Partially correct
49 Partially correct 40 ms 1196 KB Partially correct