Submission #396168

# Submission time Handle Problem Language Result Execution time Memory
396168 2021-04-29T14:04:42 Z snasibov05 Stations (IOI20_stations) C++14
0 / 100
1095 ms 608 KB
#include "stations.h"
#include <vector>

#define pb push_back

using namespace std;



vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	vector<int> labels(n);

    for (int i = 0; i < n; ++i) {
        labels[i] = i;
    }

	return labels;
}

int find_next_station(int s, int t, vector<int> c) {

    int level_s = 0, level_t = 0;

    int x = s;
    while (x > 0) level_s++, x/=2;

    if (s == (1 << (level_s + 1)) - 1) level_s++;

    x = t;
    while (x > 0) level_t++, x/=2;

    if (t == (1 << level_t) - 1) level_t++;

    int a = s;
    int b = t;

    while (level_t > level_s) b = (b-1) / 2, level_t--;

    if (a == b){
        while ((t-1)/2 != s) t = (t-1) / 2;
        return t;
    }
    else return (s-1)/2;

}
# Verdict Execution time Memory Grader output
1 Incorrect 686 ms 484 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 466 ms 480 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 550 ms 608 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1095 ms 476 KB Output is correct
2 Incorrect 727 ms 400 KB Wrong query response.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 647 ms 400 KB Wrong query response.
2 Halted 0 ms 0 KB -