Submission #803083

# Submission time Handle Problem Language Result Execution time Memory
803083 2023-08-02T21:24:14 Z HaroldVemeno Stations (IOI20_stations) C++17
0 / 100
807 ms 672 KB
#include "stations.h"
#include <bits/stdc++.h>

#ifdef GUDEB
    #define D(x) cerr << #x << ": " << (x) << '\n';
    #define ifdeb if(true)
#else
    #define D(x) ;
    #define ifdeb if(false)
#endif

#define all(x) begin(x), end(x)

using namespace std;
using ull = unsigned long long;
using ll = long long;
// #define int ll;

vector<vector<int>> al;
vector<int> labels;
int lt = 0;

void dfs(int v, int p) {
    for(auto a : al[v]) {
        if(a == p) continue;
        dfs(a, v);
    }
    labels[v] = lt++;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
    lt = 0;
    al.clear();
    al.resize(n);
	for (int i = 0; i < u.size(); i++) {
        al[u[i]].push_back(v[i]);
        al[v[i]].push_back(u[i]);
	}
    labels.clear();
    labels.resize(n);
    dfs(0, 0);
	return labels;
}

int find_next_station(int s, int t, vector<int> c) {
    for(int a : c) {
        if(a >= t) return a;
    }
    return c.back();
}

Compilation message

stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:35:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |  for (int i = 0; i < u.size(); i++) {
      |                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 516 ms 632 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 353 ms 544 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 418 ms 636 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 807 ms 500 KB Output is correct
2 Correct 558 ms 504 KB Output is correct
3 Incorrect 442 ms 420 KB Wrong query response.
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 471 ms 672 KB Wrong query response.
2 Halted 0 ms 0 KB -