답안 #869700

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
869700 2023-11-05T10:53:18 Z andrewp 기지국 (IOI20_stations) C++14
52.3205 / 100
552 ms 1464 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++){
      |                              ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 560 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6009
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 329 ms 912 KB Output is correct
2 Correct 263 ms 908 KB Output is correct
3 Correct 532 ms 684 KB Output is correct
4 Correct 368 ms 684 KB Output is correct
5 Correct 350 ms 684 KB Output is correct
6 Correct 260 ms 912 KB Output is correct
7 Correct 255 ms 684 KB Output is correct
8 Correct 1 ms 768 KB Output is correct
9 Correct 2 ms 764 KB Output is correct
10 Correct 1 ms 768 KB Output is correct
11 Correct 322 ms 772 KB Output is correct
12 Correct 277 ms 1164 KB Output is correct
13 Correct 261 ms 1444 KB Output is correct
14 Correct 240 ms 936 KB Output is correct
15 Correct 31 ms 888 KB Output is correct
16 Correct 39 ms 1104 KB Output is correct
17 Correct 67 ms 876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 501 ms 684 KB Output is correct
2 Correct 385 ms 684 KB Output is correct
3 Correct 343 ms 684 KB Output is correct
4 Correct 1 ms 760 KB Output is correct
5 Correct 3 ms 768 KB Output is correct
6 Correct 0 ms 768 KB Output is correct
7 Correct 345 ms 684 KB Output is correct
8 Correct 512 ms 684 KB Output is correct
9 Correct 377 ms 684 KB Output is correct
10 Correct 344 ms 936 KB Output is correct
11 Correct 3 ms 768 KB Output is correct
12 Correct 2 ms 764 KB Output is correct
13 Correct 2 ms 768 KB Output is correct
14 Correct 2 ms 776 KB Output is correct
15 Correct 0 ms 768 KB Output is correct
16 Correct 303 ms 684 KB Output is correct
17 Correct 291 ms 684 KB Output is correct
18 Correct 260 ms 944 KB Output is correct
19 Correct 309 ms 684 KB Output is correct
20 Correct 289 ms 684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 297 ms 1164 KB Partially correct
2 Partially correct 304 ms 908 KB Partially correct
3 Partially correct 552 ms 684 KB Partially correct
4 Partially correct 408 ms 684 KB Partially correct
5 Partially correct 388 ms 684 KB Partially correct
6 Partially correct 257 ms 916 KB Partially correct
7 Partially correct 327 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 768 KB Partially correct
11 Partially correct 308 ms 868 KB Partially correct
12 Partially correct 304 ms 844 KB Partially correct
13 Partially correct 505 ms 684 KB Partially correct
14 Partially correct 378 ms 684 KB Partially correct
15 Partially correct 348 ms 684 KB Partially correct
16 Partially correct 257 ms 684 KB Partially correct
17 Partially correct 326 ms 684 KB Partially correct
18 Partially correct 280 ms 1004 KB Partially correct
19 Partially correct 261 ms 1272 KB Partially correct
20 Partially correct 257 ms 684 KB Partially correct
21 Partially correct 32 ms 896 KB Partially correct
22 Partially correct 43 ms 872 KB Partially correct
23 Partially correct 57 ms 880 KB Partially correct
24 Partially correct 2 ms 772 KB Partially correct
25 Partially correct 3 ms 768 KB Partially correct
26 Partially correct 3 ms 764 KB Partially correct
27 Partially correct 3 ms 768 KB Partially correct
28 Partially correct 0 ms 764 KB Partially correct
29 Partially correct 283 ms 684 KB Partially correct
30 Partially correct 264 ms 684 KB Partially correct
31 Partially correct 299 ms 684 KB Partially correct
32 Partially correct 295 ms 684 KB Partially correct
33 Partially correct 283 ms 684 KB Partially correct
34 Partially correct 173 ms 900 KB Partially correct
35 Partially correct 240 ms 1284 KB Partially correct
36 Partially correct 260 ms 1160 KB Partially correct
37 Partially correct 284 ms 1152 KB Partially correct
38 Partially correct 282 ms 1156 KB Partially correct
39 Partially correct 259 ms 1308 KB Partially correct
40 Partially correct 258 ms 1416 KB Partially correct
41 Partially correct 287 ms 1260 KB Partially correct
42 Partially correct 38 ms 864 KB Partially correct
43 Partially correct 56 ms 944 KB Partially correct
44 Partially correct 87 ms 892 KB Partially correct
45 Partially correct 96 ms 892 KB Partially correct
46 Partially correct 187 ms 856 KB Partially correct
47 Partially correct 162 ms 888 KB Partially correct
48 Partially correct 37 ms 1356 KB Partially correct
49 Partially correct 33 ms 1464 KB Partially correct