답안 #432743

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
432743 2021-06-18T13:02:04 Z A_D 기지국 (IOI20_stations) C++14
36.234 / 100
886 ms 740 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> ret;
vector<vector<int>> g;
int in=0;
int out=0;
void dfs(int u,int p)
{
    ret[u]+=in++;
    for(auto x:g[u]){
        if(x==p)continue;
        dfs(x,u);
    }
    int h=(out<<10);
    out++;
    ret[u]+=h;
}
vector<int> label(int n, int k,vector<int> u,vector<int> v){
    g.clear();
    ret.clear();
    in=0;
    out=0;
    g.resize(n);
	ret.resize(n);
	for(int i=0;i<u.size();i++){
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
	}
	dfs(0,0);
	return ret;
}

int find_next_station(int s, int t,vector<int> c){
    int n=c.size();
    int inn = t%1024;
    int outt = (t>>(10));
//    cout<<inn<<" "<<outt<<endl;
    vector<int> in;
    vector<int> out;
    for(int i=0;i<c.size();i++){
        in.push_back(c[i]%1024);
        out.push_back((c[i]>>(10)));
  //     cout<<in[i]<<" "<<out[i]<<" "<<c[i]<<endl;
    }
    int mx=-1;
    for(int i=0;i<c.size();i++){
        mx=max(mx,c[i]);
    }
    for(int i=0;i<c.size();i++){
        if(mx==c[i])continue;
        if(in[i]<=inn&&outt<=out[i])return c[i];
    }
    return mx;
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:26:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  for(int i=0;i<u.size();i++){
      |              ~^~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:41:18: 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=0;i<c.size();i++){
      |                 ~^~~~~~~~~
stations.cpp:47:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |     for(int i=0;i<c.size();i++){
      |                 ~^~~~~~~~~
stations.cpp:50:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |     for(int i=0;i<c.size();i++){
      |                 ~^~~~~~~~~
stations.cpp:35:9: warning: unused variable 'n' [-Wunused-variable]
   35 |     int n=c.size();
      |         ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 328 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=9216
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 276 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=0, label=1018880
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 448 KB Invalid labels (values out of range). scenario=1, k=1000000, vertex=0, label=1019904
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 866 ms 520 KB Output is correct
2 Correct 682 ms 400 KB Output is correct
3 Correct 570 ms 400 KB Output is correct
4 Correct 4 ms 468 KB Output is correct
5 Correct 6 ms 468 KB Output is correct
6 Correct 2 ms 468 KB Output is correct
7 Correct 587 ms 492 KB Output is correct
8 Correct 851 ms 400 KB Output is correct
9 Correct 659 ms 528 KB Output is correct
10 Correct 557 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 4 ms 468 KB Output is correct
14 Correct 4 ms 468 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 487 ms 488 KB Output is correct
17 Correct 522 ms 612 KB Output is correct
18 Correct 529 ms 400 KB Output is correct
19 Correct 487 ms 532 KB Output is correct
20 Correct 501 ms 528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 542 ms 644 KB Partially correct
2 Partially correct 483 ms 616 KB Partially correct
3 Partially correct 886 ms 408 KB Partially correct
4 Partially correct 694 ms 400 KB Partially correct
5 Partially correct 565 ms 400 KB Partially correct
6 Partially correct 455 ms 528 KB Partially correct
7 Partially correct 448 ms 528 KB Partially correct
8 Partially correct 3 ms 468 KB Partially correct
9 Partially correct 3 ms 468 KB Partially correct
10 Partially correct 2 ms 468 KB Partially correct
11 Partially correct 430 ms 740 KB Partially correct
12 Partially correct 517 ms 488 KB Partially correct
13 Partially correct 886 ms 484 KB Partially correct
14 Partially correct 638 ms 492 KB Partially correct
15 Partially correct 575 ms 400 KB Partially correct
16 Partially correct 442 ms 488 KB Partially correct
17 Partially correct 596 ms 488 KB Partially correct
18 Partially correct 430 ms 712 KB Partially correct
19 Partially correct 460 ms 740 KB Partially correct
20 Partially correct 428 ms 464 KB Partially correct
21 Partially correct 58 ms 420 KB Partially correct
22 Partially correct 74 ms 568 KB Partially correct
23 Partially correct 115 ms 528 KB Partially correct
24 Partially correct 6 ms 480 KB Partially correct
25 Partially correct 5 ms 468 KB Partially correct
26 Partially correct 4 ms 468 KB Partially correct
27 Partially correct 3 ms 468 KB Partially correct
28 Partially correct 2 ms 468 KB Partially correct
29 Partially correct 513 ms 488 KB Partially correct
30 Partially correct 515 ms 484 KB Partially correct
31 Partially correct 506 ms 400 KB Partially correct
32 Partially correct 487 ms 400 KB Partially correct
33 Partially correct 519 ms 492 KB Partially correct
34 Partially correct 322 ms 528 KB Partially correct
35 Partially correct 422 ms 716 KB Partially correct
36 Partially correct 490 ms 676 KB Partially correct
37 Partially correct 459 ms 640 KB Partially correct
38 Partially correct 424 ms 620 KB Partially correct
39 Partially correct 475 ms 608 KB Partially correct
40 Partially correct 482 ms 740 KB Partially correct
41 Partially correct 444 ms 584 KB Partially correct
42 Partially correct 56 ms 532 KB Partially correct
43 Partially correct 107 ms 552 KB Partially correct
44 Partially correct 131 ms 528 KB Partially correct
45 Partially correct 177 ms 584 KB Partially correct
46 Partially correct 307 ms 528 KB Partially correct
47 Partially correct 324 ms 528 KB Partially correct
48 Partially correct 72 ms 688 KB Partially correct
49 Partially correct 78 ms 620 KB Partially correct