Submission #770426

#TimeUsernameProblemLanguageResultExecution timeMemory
770426PoonYaPatFlights (JOI22_flights)C++17
0 / 100
0 ms456 KiB
#include "Ali.h" #include <bits/stdc++.h> using namespace std; namespace { 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; dfs(s,x,l); } } } 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') b+=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) { for (int j=0; j<14; ++j) { if (dis[i][s]&(1<<j)) ans+="1"; else ans+="0"; } } } return ans; }
#include "Benjamin.h" #include <bits/stdc++.h> using namespace std; namespace { int XX,YY,NN; } string SendB(int N, int X, int Y) { NN=N; string ans=""; XX=X; YY=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 Answer(std::string T) { int xx=XX/1024, yy=YY/1024; vector<int> posA,posB; for (int i=0; i<NN; ++i) { if (i%1024==xx) posA.push_back(i); if (i%1024==yy) posB.push_back(i); } int st=(xx*posB.size()+yy)*14; cout<<st<<"\n"; 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:49:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |   for (int i=0; i<posA.size(); ++i) {
      |                 ~^~~~~~~~~~~~
Ali.cpp: At global scope:
Ali.cpp:7:7: warning: '{anonymous}::id' defined but not used [-Wunused-variable]
    7 |   int id[10001],n;
      |       ^~
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...