Submission #890080

#TimeUsernameProblemLanguageResultExecution timeMemory
890080TAhmed33Flights (JOI22_flights)C++17
0 / 100
8 ms1888 KiB
#include "Ali.h" #include <bits/stdc++.h> using namespace std; vector <int> adj[10001]; int n2; void Init (int N, vector <int> a, vector <int> b) { n2 = N; for (int i = 0; i < n2; i++) adj[i].clear(); for (int i = 0; i + 1 < n2; i++) { adj[a[i]].push_back(b[i]); adj[b[i]].push_back(a[i]); } for (int i = 0; i < n2; i++) { SetID(i, i); } } string get (int x) { string ret; for (int i = 13; i >= 0; i--) { if ((x >> i) & 1) ret += '1'; else ret += '0'; } return ret; } string t; void dfs (int pos, int par, int dep) { t += get(pos); t += get(dep); for (auto j : adj[pos]) if (j != par) dfs(j, pos, dep + 1); } string SendA (string s) { int x = 0; for (auto i : s) { x *= 2; if (i == '1') x++; } t.clear(); dfs(x, -1, 0); return t; }
#include "Benjamin.h" #include <bits/stdc++.h> using namespace std; int n, xx, yy; string SendB (int N, int X, int Y) { n = N; xx = X; yy = Y; string ret; for (int i = 13; i >= 0; i--) { if ((xx >> i) & 1) ret += '1'; else ret += '0'; } while (ret.size() < 20) ret = '0' + ret; return ret; } int Answer (string t) { for (int i = 0; i < (int)t.length(); i += 28) { int z = 0; for (int j = i; j <= i + 13; j++) { z *= 2; if (t[j] == '1') z++; } if (z == yy) { int ret = 0; for (int j = i + 14; j <= i + 27; j++) { ret *= 2; if (t[j] == '1') ret++; } return ret; } } }

Compilation message (stderr)

grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~

Benjamin.cpp: In function 'int Answer(std::string)':
Benjamin.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
   30 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...