Submission #517101

# Submission time Handle Problem Language Result Execution time Memory
517101 2022-01-22T14:08:10 Z Ai7081 Stations (IOI20_stations) C++17
0 / 100
843 ms 484 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1005;

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
    vector<int> ret(n);
    for (int i=0; i<n; i++) ret[i] = i+1;
    return ret;
}

int find_next_station(int s, int t, vector<int> c) {
    bitset<15> a, b;
    int tmp = s, s1 = 0, s2 = 0;
    while (tmp > 0) a[s1] = tmp%2, tmp = (tmp>>1), s1++;
    tmp = t;
    while (tmp > 0) b[s2] = tmp%2, tmp = (tmp>>1), s2++;
    /*
    for (int i=0; i<s1; i++) cout << a[i];
    cout << endl;
    for (int i=0; i<s2; i++) cout << b[i];
    cout << endl;
    */
    bitset<15> go;
    int s3 = 0;
    for (int i=1; i<=min(s1, s2); i++) {
        if (a[s1-i] != b[s2-i]) break;
        go[i-1] = a[s1-i];
        s3 = i;
    }
    /*
    for (int i=0; i<s3; i++) cout << go[i];
    cout << endl;
    */
    int lca = 0;
    for (int i=0; i<s3; i++) lca += go[i] * (s3-1-i);
    //cout << lca << endl;
    if (lca < s) return s/2;
    return 2 * s + b[s1];
}
# Verdict Execution time Memory Grader output
1 Incorrect 521 ms 424 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 441 ms 484 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 523 ms 400 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 843 ms 476 KB Wrong query response.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 485 ms 400 KB Wrong query response.
2 Halted 0 ms 0 KB -