Submission #567852

#TimeUsernameProblemLanguageResultExecution timeMemory
567852dantoh000Flights (JOI22_flights)C++17
28 / 100
1383 ms1800 KiB
#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 (stderr)

grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...