Submission #770412

#TimeUsernameProblemLanguageResultExecution timeMemory
770412PoonYaPatFlights (JOI22_flights)C++17
0 / 100
0 ms456 KiB
#include "Ali.h" #include <bits/stdc++.h> using namespace std; vector<int> adj[10001]; int id[10001],n; int dis[15][10001]; void dfs(int x, int par, int l) { for (auto s : adj[x]) { if (s==par) continue; dis[l][s]=dis[l][x]+1; } } void Init(int N, std::vector<int> U, std::vector<int> V) { n=N; for (int i=0; i<n; ++i) adj[i].clear(); for (int i=0; i<n-1; ++i) { adj[U[i]].push_back(V[i]); adj[V[i]].push_back(U[i]); } for (int i=0; i<n; ++i) SetID(i,i); } string SendA(std::string S) { int pow=1,a=0,b=0; for (int i=0; i<10; ++i) { if (S[i]=='1') a+=pow; pow*=2; } pow=1; for (int i=10; i<20; ++i) { if (S[i]=='1') a+=pow; pow*=2; } vector<int> posA,posB; for (int i=0; i<n; ++i) { if (i%1024==a) posA.push_back(i); if (i%1024==b) posB.push_back(i); } string ans=""; for (int i=0; i<posA.size(); ++i) { dis[i][posA[i]]=0; dfs(posA[i],-1,i); for (auto s : posB) { //consider dis[i][s] for (int i=0; i<14; ++i) { if (dis[i][s]&(1<<i)) ans+="1"; else ans+="0"; } } } return ans; }
#include "Benjamin.h" #include <bits/stdc++.h> using namespace std; int x,y,n; string SendB(int N, int X, int Y) { n=N; string ans=""; x=X; y=Y; for (int i=0; i<10; ++i) { if (X&(1<<i)) ans+="1"; else ans+="0"; } for (int i=0; i<10; ++i) { if (Y&(1<<i)) ans+="1"; else ans+="0"; } return ans; } int dis[11][11]; int Answer(std::string T) { int xx=x%1024, yy=y%1024; vector<int> posA,posB; for (int i=0; i<n; ++i) { if (i%1024==xx) posA.push_back(i); if (i%1024==yy) posB.push_back(i); } int st=((xx-1)*posB.size()+yy)*14; int ans=0,pow=1; for (int i=st; i<st+14; ++i) { if (T[i]=='1') ans+=pow; pow*=2; } return ans; }

Compilation message (stderr)

Ali.cpp: In function 'std::string SendA(std::string)':
Ali.cpp:47:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |   for (int i=0; i<posA.size(); ++i) {
      |                 ~^~~~~~~~~~~~
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...