답안 #652902

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
652902 2022-10-25T03:42:56 Z coding_snorlax 기지국 (IOI20_stations) C++14
52.3244 / 100
971 ms 776 KB
#include "stations.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> G[1005];
int sub_tree_size[1005];
int vis[1005]={0};
int tree_order[1005];
int now_order=0;
int dfs(int node){
    vis[node]=1;
    
    tree_order[node]=now_order;
    now_order++;
    int Count=0;
    for(int i:G[node]){
        if(!vis[i]){
            Count+=dfs(i);
        }
    }
    sub_tree_size[node]=Count;
    return Count+1;
}
void get_graph(vector<int> G1,vector<int> G2){
    for(int i=0;i<1005;i++){
 		G[i].clear();
    }
    for(int i=0;i<(int)G1.size();i++){
        G[G1[i]].push_back(G2[i]);
        G[G2[i]].push_back(G1[i]);
    }
    for(int i=0;i<1005;i++){
        vis[i]=0;
        now_order=0;
    }
    dfs(0);
    return;
}
vector<int> label(int n,int k,vector<int> u,vector<int> v){
    vector<int> Answer;
    get_graph(u,v);
    for(int i=0;i<n;i++){
        Answer.push_back(sub_tree_size[i]+1000*tree_order[i]);
    }
    return Answer;
}
//s/1000 is node, s%1000 is connect place
int find_next_station(int s,int t,vector<int> c){
    int now_node=s/1000;
    //root node
    if(now_node==0){
        for(int i=0;i<(int)c.size();i++){
            int check=c[i]/1000;
            int Plus=c[i]%1000;
            if(check<=t/1000 && t/1000<=check+Plus){
                return c[i];
            }
        }
    }
    else{
        for(int i=1;i<(int)c.size();i++){
            int check=c[i]/1000;
            int Plus=c[i]%1000;
            if(check<=t/1000 && t/1000<=check+Plus){
                return c[i];
            }
        }
        return c[0];
    }
 
}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:70:1: warning: control reaches end of non-void function [-Wreturn-type]
   70 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 336 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6003
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 336 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1510
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 474 ms 544 KB Output is correct
2 Correct 481 ms 568 KB Output is correct
3 Correct 971 ms 420 KB Output is correct
4 Correct 605 ms 552 KB Output is correct
5 Correct 498 ms 592 KB Output is correct
6 Correct 464 ms 532 KB Output is correct
7 Correct 433 ms 540 KB Output is correct
8 Correct 3 ms 508 KB Output is correct
9 Correct 3 ms 636 KB Output is correct
10 Correct 0 ms 628 KB Output is correct
11 Correct 571 ms 584 KB Output is correct
12 Correct 405 ms 640 KB Output is correct
13 Correct 479 ms 644 KB Output is correct
14 Correct 407 ms 548 KB Output is correct
15 Correct 44 ms 620 KB Output is correct
16 Correct 59 ms 600 KB Output is correct
17 Correct 91 ms 544 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 881 ms 516 KB Output is correct
2 Correct 651 ms 420 KB Output is correct
3 Correct 599 ms 420 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 4 ms 620 KB Output is correct
6 Correct 1 ms 636 KB Output is correct
7 Correct 491 ms 416 KB Output is correct
8 Correct 888 ms 532 KB Output is correct
9 Correct 653 ms 548 KB Output is correct
10 Correct 562 ms 532 KB Output is correct
11 Correct 6 ms 492 KB Output is correct
12 Correct 8 ms 632 KB Output is correct
13 Correct 7 ms 620 KB Output is correct
14 Correct 4 ms 472 KB Output is correct
15 Correct 2 ms 600 KB Output is correct
16 Correct 464 ms 524 KB Output is correct
17 Correct 462 ms 548 KB Output is correct
18 Correct 469 ms 544 KB Output is correct
19 Correct 417 ms 544 KB Output is correct
20 Correct 511 ms 416 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 486 ms 636 KB Partially correct
2 Partially correct 494 ms 524 KB Partially correct
3 Correct 839 ms 420 KB Output is correct
4 Partially correct 566 ms 528 KB Partially correct
5 Partially correct 592 ms 524 KB Partially correct
6 Partially correct 422 ms 540 KB Partially correct
7 Partially correct 449 ms 536 KB Partially correct
8 Partially correct 2 ms 628 KB Partially correct
9 Partially correct 4 ms 644 KB Partially correct
10 Partially correct 1 ms 620 KB Partially correct
11 Partially correct 411 ms 544 KB Partially correct
12 Partially correct 525 ms 572 KB Partially correct
13 Correct 809 ms 440 KB Output is correct
14 Partially correct 571 ms 604 KB Partially correct
15 Partially correct 570 ms 672 KB Partially correct
16 Partially correct 424 ms 544 KB Partially correct
17 Partially correct 546 ms 552 KB Partially correct
18 Partially correct 370 ms 664 KB Partially correct
19 Partially correct 389 ms 652 KB Partially correct
20 Partially correct 484 ms 548 KB Partially correct
21 Partially correct 52 ms 572 KB Partially correct
22 Partially correct 63 ms 600 KB Partially correct
23 Partially correct 110 ms 700 KB Partially correct
24 Partially correct 4 ms 628 KB Partially correct
25 Partially correct 6 ms 516 KB Partially correct
26 Partially correct 4 ms 628 KB Partially correct
27 Partially correct 4 ms 500 KB Partially correct
28 Partially correct 2 ms 628 KB Partially correct
29 Partially correct 423 ms 552 KB Partially correct
30 Partially correct 515 ms 444 KB Partially correct
31 Partially correct 538 ms 532 KB Partially correct
32 Partially correct 545 ms 512 KB Partially correct
33 Partially correct 493 ms 564 KB Partially correct
34 Partially correct 312 ms 548 KB Partially correct
35 Partially correct 400 ms 544 KB Partially correct
36 Partially correct 486 ms 536 KB Partially correct
37 Partially correct 415 ms 548 KB Partially correct
38 Partially correct 460 ms 660 KB Partially correct
39 Partially correct 364 ms 776 KB Partially correct
40 Partially correct 447 ms 652 KB Partially correct
41 Partially correct 475 ms 724 KB Partially correct
42 Partially correct 68 ms 700 KB Partially correct
43 Partially correct 96 ms 696 KB Partially correct
44 Partially correct 135 ms 680 KB Partially correct
45 Partially correct 139 ms 640 KB Partially correct
46 Partially correct 308 ms 544 KB Partially correct
47 Partially correct 352 ms 532 KB Partially correct
48 Partially correct 65 ms 664 KB Partially correct
49 Partially correct 69 ms 676 KB Partially correct