Submission #308351

# Submission time Handle Problem Language Result Execution time Memory
308351 2020-10-01T00:56:48 Z chubyxdxd Stations (IOI20_stations) C++17
5 / 100
1168 ms 1024 KB
#include "stations.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;
vector<vector<int>> G;
vector<int> gg;
vector<int> labels;
int id=0;
void dfs(int node,int pad){
  labels[node]=id;
  id++;
  for(auto i:G[node]){
    if(i==pad)continue;
    dfs(i,node);
  }
}
vector<int> label(int n, int k,vector<int> u,vector<int> v) {
  G.clear();
  id=0;
  G.assign(n+10,vector<int>());
  for(int i=0;i<int(u.size());i++){
    G[u[i]].push_back(v[i]);
    G[v[i]].push_back(u[i]);
  }
  int piv=0;
  labels.assign(n,0);
  for(int i=0;i<n;i++){
    if(G[i].size()==1){
      dfs(i,-1);
      break;
    }
  }
  return labels;
}
 
int find_next_station(int s, int t,vector<int> c) {
  if(int(c.size())==1)return c[0];
  if(s<t)return max(c[0],c[1]);
  else return min(c[0],c[1]);
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:25:7: warning: unused variable 'piv' [-Wunused-variable]
   25 |   int piv=0;
      |       ^~~
# Verdict Execution time Memory Grader output
1 Correct 503 ms 1024 KB Output is correct
2 Correct 448 ms 772 KB Output is correct
3 Correct 883 ms 760 KB Output is correct
4 Correct 686 ms 768 KB Output is correct
5 Correct 589 ms 644 KB Output is correct
6 Correct 555 ms 760 KB Output is correct
7 Correct 444 ms 792 KB Output is correct
8 Correct 2 ms 640 KB Output is correct
9 Correct 4 ms 648 KB Output is correct
10 Correct 1 ms 648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 527 ms 764 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 619 ms 1024 KB Output is correct
2 Correct 561 ms 772 KB Output is correct
3 Correct 938 ms 644 KB Output is correct
4 Correct 638 ms 640 KB Output is correct
5 Correct 603 ms 652 KB Output is correct
6 Correct 457 ms 776 KB Output is correct
7 Correct 487 ms 784 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 3 ms 656 KB Output is correct
10 Correct 1 ms 640 KB Output is correct
11 Incorrect 659 ms 640 KB Wrong query response.
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1168 ms 768 KB Output is correct
2 Correct 678 ms 648 KB Output is correct
3 Correct 772 ms 772 KB Output is correct
4 Correct 3 ms 648 KB Output is correct
5 Correct 4 ms 768 KB Output is correct
6 Correct 1 ms 652 KB Output is correct
7 Incorrect 753 ms 640 KB Wrong query response.
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 660 ms 1024 KB Output is correct
2 Correct 616 ms 772 KB Output is correct
3 Correct 1142 ms 640 KB Output is correct
4 Correct 662 ms 640 KB Output is correct
5 Correct 692 ms 768 KB Output is correct
6 Correct 434 ms 768 KB Output is correct
7 Correct 516 ms 768 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 5 ms 640 KB Output is correct
10 Correct 2 ms 648 KB Output is correct
11 Incorrect 450 ms 804 KB Wrong query response.
12 Halted 0 ms 0 KB -