Submission #567852

# Submission time Handle Problem Language Result Execution time Memory
567852 2022-05-24T09:25:10 Z dantoh000 Flights (JOI22_flights) C++17
28 / 100
1383 ms 1800 KB
#include "Ali.h"
#include <bits/stdc++.h>
using namespace std;

namespace {
    int N;
    vector<int> G[10005];
    int d[10005];

}

void Init(int _N, std::vector<int> U, std::vector<int> V) {
    N = _N;
    for (int i = 0; i < N; i++) G[i].clear();
    for (int i = 0; i < N-1; i++){
        G[U[i]].push_back(V[i]);
        G[V[i]].push_back(U[i]);
    }
    for (int i = 0; i < N; i++){
        SetID(i, i);
    }
}

void dfs(int u, int p){
    for (auto v : G[u]){
        if (v == p) continue;
        d[v] = d[u]+1;
        dfs(v,u);
    }
}


int findDist(int U, int V){
    d[U] = 0;
    dfs(U, -1);
    ///printf("dist between %d and %d is %d\n",U,V,d[V]);
    return d[V];

}
std::string SendA(std::string S) {
    int ID = 0;
    for (int i = 0; i < 20; i++){
        ID *= 2;
        ID += (S[i]-'0');
    }
    string T = "";
    ID <<= 6;
    for (int j = 0; j < 64; j++){
        int TARGET = ID + j;
        int CUR = 0;
        for (int i = 0; i < N; i++){
            if (CUR + i > TARGET){
                int X = i, Y = TARGET-CUR;
                int D = findDist(X,Y);
                for (int k = 13; k >= 0; k--){
                    T += (char)((D>>k&1)+'0');
                }
                break;
            }
            CUR += i;
        }
    }
    ///cout << "Ali sending " << T << endl;
    return T;
}
#include "Benjamin.h"
#include <bits/stdc++.h>
using namespace std;

namespace {
    int ID = 0;
}

std::string SendB(int N, int X, int Y) {

    ID = 0;
    if (X < Y) swap(X,Y);
    for (int i = 0; i < X; i++){
        ID += i;
    }
    ID += Y;
    string s = "";
    for (int i = 25; i > 5; i--){
        s += (char)((ID>>i&1)+'0');
    }
    ///cout << "Ben sending " << s << endl;
    return s;

}

int Answer(std::string T) {
    int offset = ID&(0b111111);
    int ans = 0;
    for (int i = offset*14; i < offset*14+14; i++){
        ans *= 2;
        ans += (T[i]-'0');
    }

    return ans;
}

Compilation message

grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 656 KB Output is correct
2 Correct 2 ms 656 KB Output is correct
3 Correct 1 ms 744 KB Output is correct
4 Correct 2 ms 656 KB Output is correct
5 Correct 2 ms 656 KB Output is correct
6 Correct 20 ms 1312 KB Output is correct
7 Correct 19 ms 1204 KB Output is correct
8 Correct 23 ms 1168 KB Output is correct
9 Correct 19 ms 1232 KB Output is correct
10 Correct 25 ms 1424 KB Output is correct
11 Correct 13 ms 1176 KB Output is correct
12 Correct 13 ms 1284 KB Output is correct
13 Correct 13 ms 1296 KB Output is correct
14 Correct 16 ms 1168 KB Output is correct
15 Correct 12 ms 1588 KB Output is correct
16 Correct 12 ms 1324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 656 KB Output is partially correct
2 Partially correct 168 ms 1620 KB Output is partially correct
3 Partially correct 5 ms 764 KB Output is partially correct
4 Partially correct 1016 ms 1340 KB Output is partially correct
5 Partially correct 994 ms 1424 KB Output is partially correct
6 Partially correct 967 ms 1584 KB Output is partially correct
7 Partially correct 873 ms 1800 KB Output is partially correct
8 Partially correct 1027 ms 1356 KB Output is partially correct
9 Partially correct 602 ms 1672 KB Output is partially correct
10 Partially correct 571 ms 1636 KB Output is partially correct
11 Partially correct 787 ms 1388 KB Output is partially correct
12 Partially correct 71 ms 1272 KB Output is partially correct
13 Partially correct 364 ms 1516 KB Output is partially correct
14 Partially correct 483 ms 1500 KB Output is partially correct
15 Partially correct 10 ms 784 KB Output is partially correct
16 Partially correct 545 ms 1732 KB Output is partially correct
17 Partially correct 495 ms 1640 KB Output is partially correct
18 Partially correct 583 ms 1588 KB Output is partially correct
19 Partially correct 592 ms 1692 KB Output is partially correct
20 Partially correct 322 ms 1536 KB Output is partially correct
21 Partially correct 511 ms 1640 KB Output is partially correct
22 Partially correct 565 ms 1516 KB Output is partially correct
23 Partially correct 560 ms 1588 KB Output is partially correct
24 Partially correct 551 ms 1572 KB Output is partially correct
25 Partially correct 533 ms 1376 KB Output is partially correct
26 Partially correct 524 ms 1352 KB Output is partially correct
27 Partially correct 555 ms 1412 KB Output is partially correct
28 Partially correct 540 ms 1332 KB Output is partially correct
29 Partially correct 582 ms 1420 KB Output is partially correct
30 Partially correct 580 ms 1324 KB Output is partially correct
31 Partially correct 545 ms 1328 KB Output is partially correct
32 Partially correct 588 ms 1444 KB Output is partially correct
33 Partially correct 573 ms 1320 KB Output is partially correct
34 Partially correct 603 ms 1456 KB Output is partially correct
35 Partially correct 610 ms 1476 KB Output is partially correct
36 Partially correct 593 ms 1392 KB Output is partially correct
37 Partially correct 562 ms 1416 KB Output is partially correct
38 Partially correct 560 ms 1488 KB Output is partially correct
39 Partially correct 98 ms 1376 KB Output is partially correct
40 Partially correct 1383 ms 1688 KB Output is partially correct