답안 #419084

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
419084 2021-06-06T12:07:59 Z NintsiChkhaidze 기지국 (IOI20_stations) C++14
36.3129 / 100
1081 ms 800 KB
#include "stations.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
vector <int> vec[1005];
int cnt,in[1005],out[1005];
bool q=0;
void dfs(int x,int p){
    in[x] = ++cnt;
    for (int j=0;j<vec[x].size();j++){
        int to = vec[x][j];
        if (to == p) continue;
        dfs(to,x);
    }
    out[x] = cnt;
}
 
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
    q=0;
    if (k <= 1000000){
        q=1;
        vector<int> labels;
        for (int i=0;i<n;i++)
            labels.pb(i);
        return labels;  
    }
    vector<int> labels;
    for (int i=0;i<1001;i++){
        vec[i].clear();
        in[i] = out[i] = 0;
    }
    for (int i=0;i<u.size();i++){
        vec[u[i]].pb(v[i]);
        vec[v[i]].pb(u[i]);
    }
    
    cnt=0;
    dfs(0,0);
    for (int i=0;i<n;i++)
        labels.pb(in[i]*1001 + out[i]);
    
    return labels;
}
int find_next_station(int s, int t, vector<int> c) {
    if (q){
        if (c[0] == t) return t;
        if (c.size() > 1 && c[1] == t) return t;
    }
    int Ins = (s/1001),Int = (t/1001),Out = (t%1001);
    if (Ins < Int){
        for (int i=1;i<c.size();i++)
            if (Int >= (c[i]/1001) && (c[i]%1001) >= Out) return c[i];
    }
    return c[0];
}

Compilation message

stations.cpp: In function 'void dfs(int, int)':
stations.cpp:10:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for (int j=0;j<vec[x].size();j++){
      |                  ~^~~~~~~~~~~~~~
stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:32:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for (int i=0;i<u.size();i++){
      |                  ~^~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:51:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |         for (int i=1;i<c.size();i++)
      |                      ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 676 ms 520 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 500 ms 712 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 597 ms 528 KB Wrong query response.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1063 ms 400 KB Output is correct
2 Correct 700 ms 400 KB Output is correct
3 Correct 726 ms 512 KB Output is correct
4 Correct 3 ms 468 KB Output is correct
5 Correct 6 ms 448 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 729 ms 516 KB Output is correct
8 Correct 840 ms 524 KB Output is correct
9 Correct 765 ms 516 KB Output is correct
10 Correct 797 ms 400 KB Output is correct
11 Correct 5 ms 468 KB Output is correct
12 Correct 6 ms 468 KB Output is correct
13 Correct 7 ms 468 KB Output is correct
14 Correct 4 ms 448 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 564 ms 528 KB Output is correct
17 Correct 583 ms 528 KB Output is correct
18 Correct 689 ms 528 KB Output is correct
19 Correct 618 ms 516 KB Output is correct
20 Correct 666 ms 528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 637 ms 644 KB Partially correct
2 Partially correct 495 ms 640 KB Partially correct
3 Partially correct 990 ms 508 KB Partially correct
4 Partially correct 724 ms 400 KB Partially correct
5 Partially correct 693 ms 520 KB Partially correct
6 Partially correct 593 ms 528 KB Partially correct
7 Partially correct 568 ms 492 KB Partially correct
8 Partially correct 3 ms 540 KB Partially correct
9 Partially correct 5 ms 476 KB Partially correct
10 Partially correct 2 ms 468 KB Partially correct
11 Partially correct 584 ms 560 KB Partially correct
12 Partially correct 762 ms 528 KB Partially correct
13 Partially correct 1081 ms 580 KB Partially correct
14 Partially correct 750 ms 512 KB Partially correct
15 Partially correct 710 ms 512 KB Partially correct
16 Partially correct 586 ms 512 KB Partially correct
17 Partially correct 672 ms 400 KB Partially correct
18 Partially correct 499 ms 632 KB Partially correct
19 Partially correct 522 ms 632 KB Partially correct
20 Partially correct 592 ms 656 KB Partially correct
21 Partially correct 56 ms 528 KB Partially correct
22 Partially correct 84 ms 676 KB Partially correct
23 Partially correct 131 ms 656 KB Partially correct
24 Partially correct 6 ms 548 KB Partially correct
25 Partially correct 6 ms 468 KB Partially correct
26 Partially correct 5 ms 468 KB Partially correct
27 Partially correct 5 ms 464 KB Partially correct
28 Partially correct 2 ms 468 KB Partially correct
29 Partially correct 562 ms 516 KB Partially correct
30 Partially correct 605 ms 400 KB Partially correct
31 Partially correct 575 ms 512 KB Partially correct
32 Partially correct 578 ms 520 KB Partially correct
33 Partially correct 566 ms 516 KB Partially correct
34 Partially correct 343 ms 552 KB Partially correct
35 Partially correct 509 ms 600 KB Partially correct
36 Partially correct 579 ms 636 KB Partially correct
37 Partially correct 525 ms 632 KB Partially correct
38 Partially correct 540 ms 696 KB Partially correct
39 Partially correct 553 ms 624 KB Partially correct
40 Partially correct 548 ms 636 KB Partially correct
41 Partially correct 524 ms 636 KB Partially correct
42 Partially correct 66 ms 528 KB Partially correct
43 Partially correct 169 ms 648 KB Partially correct
44 Partially correct 161 ms 592 KB Partially correct
45 Partially correct 205 ms 528 KB Partially correct
46 Partially correct 370 ms 512 KB Partially correct
47 Partially correct 313 ms 528 KB Partially correct
48 Partially correct 85 ms 800 KB Partially correct
49 Partially correct 70 ms 772 KB Partially correct