Submission #770370

#TimeUsernameProblemLanguageResultExecution timeMemory
770370PlurmFlights (JOI22_flights)C++17
21 / 100
1156 ms1940 KiB
#include "Ali.h" #include <string> #include <vector> using namespace std; namespace { const int MODX = 1024; const int MODY = 1024; int N; vector<int> g[10005]; } // namespace int dist(int u, int v, int p = -1) { int mn = 1e9; if (u == v) return 0; for (int w : g[u]) { if (w == p) continue; mn = min(mn, dist(w, v, u) + 1); } return mn; } void Init(int N, std::vector<int> U, std::vector<int> V) { ::N = N; for (int i = 0; i < N; i++) SetID(i, i); for (int i = 0; i < 10005; 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]); } } std::string SendA(std::string S) { int mx = 0; int my = 0; for (int i = 0; i < 10; i++) { if (S[i] == '1') mx |= 1 << i; } for (int i = 0; i < 10; i++) { if (S[10 + i] == '1') my |= 1 << i; } std::string out; for (int i = 0; i < N; i++) { if (i % MODX == mx) { for (int j = 0; j < N; j++) { if (j % MODY == my) { int d = dist(i, j); for (int b = 0; b < 14; b++) { if (d & (1 << b)) out.push_back('1'); else out.push_back('0'); } } } } } return out; }
#include "Benjamin.h" #include <string> #include <vector> using namespace std; namespace { const int MODX = 1024; const int MODY = 1024; int N, X, Y; } // namespace std::string SendB(int N, int X, int Y) { ::N = N; ::X = X; ::Y = Y; int mx = X % MODX; int my = Y % MODY; std::string msg; for (int i = 0; i < 10; i++) { if (mx & (1 << i)) msg.push_back('1'); else msg.push_back('0'); } for (int i = 0; i < 10; i++) { if (my & (1 << i)) msg.push_back('1'); else msg.push_back('0'); } return msg; } int Answer(std::string T) { int mx = X % MODX; int my = Y % MODY; int c = 0; for (int i = 0; i < N; i++) { if (i % MODY == mx) { for (int j = 0; j < N; j++) { if (j % MODY == my) { if (i == X && j == Y) { goto NXT; } c += 14; } } } } NXT: int d = 0; for (int i = 0; i < 14; i++) { if (T[c + i] == '1') d |= 1 << i; } 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...