Submission #1062370

#TimeUsernameProblemLanguageResultExecution timeMemory
106237012345678Flights (JOI22_flights)C++17
15 / 100
5 ms1776 KiB
#include "Ali.h" #include <bits/stdc++.h> using namespace std; const int nx=1e4+5; int n, dist[nx]; vector<int> d[nx]; void dfs(int u, int p) { for (auto v:d[u]) if (v!=p) dist[v]=dist[u]+1, dfs(v, u); } void Init(int N, std::vector<int> U, std::vector<int> V) { n=N; for (int i=0; i<n; i++) d[i].clear(); for (int i=0; i<N-1; i++) d[U[i]].push_back(V[i]), d[V[i]].push_back(U[i]); for (int i=0; i<N;i ++) SetID(i, i); } std::string SendA(std::string S) { int x=0, y=0; for (int i=0; i<14; i++) if (S[i]=='1') x+=(1<<i); dfs(x, x); for (int i=0; i<6; i++) if (S[i+14]=='1') y+=(1<<i); string res; for (int i=0; i<(1<<8); i++) { if ((i<<6)+y<n) { for (int j=0; j<14; j++) { if (dist[(i<<6)+y]&(1<<j)) res.push_back('1'); else res.push_back('0'); } } } return res; }
#include "Benjamin.h" #include <bits/stdc++.h> using namespace std; int bn, bx, by, tmp; std::string SendB(int N, int X, int Y) { bn=N, bx=X, by=Y; tmp=0; string s; for (int i=0; i<14; i++) { if (X&(1<<i)) s+='1'; else s+='0'; } for (int i=0; i<6; i++) { tmp+=Y&(1<<i); if (Y&(1<<i)) s+='1'; else s+='0'; } return s; } int Answer(std::string T) { int cur=0, res=0; for (int i=0; i<(1<<8); i++) { if ((i<<6)+tmp==by) { for (int j=0; j<14; j++) res+=(T[cur+j]-'0')*(1<<j); return res; } else if ((i<<6)+tmp<bn) cur+=14; } }

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:38:1: warning: control reaches end of non-void function [-Wreturn-type]
   38 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...