Submission #307407

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3074072020-09-28 04:27:57arthur_nascimentoStations (IOI20_stations)C++14
100 / 100
1081 ms1284 KiB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define debug
#define maxn 2020
int ini[maxn];
int fim[maxn];
int mrk[maxn];
int h[maxn];
vector<int> L[maxn];
int cur = 0;
void dfs(int x){
debug("dfs %d\n",x);
ini[x] = cur++;
for(int i : L[x])
if(ini[i] == 0 && i > 0){
h[i] = 1 + h[x];
dfs(i);
}
fim[x] = cur++;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
cur = 0;
for(int i=0;i<2*n;i++)
L[i].clear(), h[i] = ini[i] = fim[i] = 0, mrk[i] = 0;
for(int i=0;i<n-1;i++){
L[u[i]].pb(v[i]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

stations.cpp: In function 'void dfs(int)':
stations.cpp:15:8: warning: left operand of comma operator has no effect [-Wunused-value]
   15 |  debug("dfs %d\n",x);
      |        ^~~~~~~~~~
stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:48:9: warning: left operand of comma operator has no effect [-Wunused-value]
   48 |   debug("%d ",i);
      |         ^~~~~
stations.cpp:49:8: warning: statement has no effect [-Wunused-value]
   49 |  debug("\n");
      |       ~^~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:54:8: warning: left operand of comma operator has no effect [-Wunused-value]
   54 |  debug("qr %d %d ~",s,t); for(int i : c) debug("%d ",i); debug("\n");
      |        ^~~~~~~~~~~~
stations.cpp:54:23: warning: right operand of comma operator has no effect [-Wunused-value]
   54 |  debug("qr %d %d ~",s,t); for(int i : c) debug("%d ",i); debug("\n");
      |                       ^
stations.cpp:54:48: warning: left operand of comma operator has no effect [-Wunused-value]
   54 |  debug("qr %d %d ~",s,t); for(int i : c) debug("%d ",i); debug("\n");
      |                                                ^~~~~
stations.cpp:54:64: warning: statement has no effect [-Wunused-value]
   54 |  debug("qr %d %d ~",s,t); for(int i : c) debug("%d ",i); debug("\n");
      |                                                               ~^~~~~
stations.cpp:62:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |   for(int i=0;i<c.size();i++){
      |               ~^~~~~~~~~
stations.cpp:73:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |   for(int i=1;i<c.size()-1;i++){
      |               ~^~~~~~~~~~~
stations.cpp:78:1: warning: control reaches end of non-void function [-Wreturn-type]
   78 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...