Submission #938145

#TimeUsernameProblemLanguageResultExecution timeMemory
938145rainboyFlights (JOI22_flights)C++17
0 / 100
3 ms1024 KiB
#include "Ali.h" #include <string> #include <vector> typedef std::vector<int> vi; typedef std::string str; namespace { const int N = 100000; int ej[N][3], eo[N]; void append(int i, int j) { ej[i][eo[i]++] = j; } str aa; int k, l; void dfs(int p, int i) { SetID(i, k++); if (p != -1) aa[l++] = '0'; for (int o = eo[i]; o--; ) { int j = ej[i][o]; if (j != p) dfs(i, j); } if (p != -1) aa[l++] = '1'; } } void Init(int n, vi ii, vi jj) { for (int i = 0; i < n; i++) eo[i] = 0; for (int h = 0; h < n - 1; h++) append(ii[h], jj[h]), append(jj[h], ii[h]); aa.resize((n - 1) * 2), k = l = 0; dfs(-1, 0); } str SendA(str bb) { return aa; }
#include "Benjamin.h" #include <string> #include <vector> typedef std::vector<int> vi; typedef std::string str; namespace { const int N = 100000; int dd[N], pp[N], qu[N], n, u, v; } str SendB(int n_, int u_, int v_) { n = n_, u = u_, v = v_; return "00000000001111111111"; } int Answer(str aa) { int cnt; cnt = 0; pp[0] = -1, dd[0] = 0, qu[cnt++] = 0; for (int i = 0, k = 1; i < (n - 1) * 2; i++) if (aa[i] == '0') dd[k] = dd[qu[cnt - 1]] + 1, pp[k] = qu[cnt - 1], qu[cnt++] = k++; else cnt--; int d = 0; while (u != v) { d++; if (dd[u] > dd[v]) u = pp[u]; else v = pp[v]; } return d; }

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...