Submission #897011

#TimeUsernameProblemLanguageResultExecution timeMemory
897011alexander707070Flights (JOI22_flights)C++17
15 / 100
23 ms2392 KiB
#include<bits/stdc++.h> #include "Ali.h" #define MAXN 10007 using namespace std; namespace{ int n,xx,yy; bool dali; vector<int> v[MAXN],w; int dist[MAXN]; void dfs(int x,int p,int d){ dist[x]=d; for(int i=0;i<v[x].size();i++){ if(v[x][i]==p)continue; dfs(v[x][i],x,d+1); } } } void Init(int N, vector<int> U, vector<int> V){ n=N; for(int i=0;i<n;i++)v[i].clear(); w.clear(); for(int i=0;i<n-1;i++){ v[U[i]].push_back(V[i]); v[V[i]].push_back(U[i]); } for(int i=0;i<=n-1;i++){ SetID(i,i); } } string SendA(string S){ xx=yy=0; for(int i=0;i<10;i++){ xx*=2; if(S[i]=='1')xx++; } for(int i=0;i<10;i++){ yy*=2; if(S[10+i]=='1')yy++; } string res=""; for(int i=0;i<10;i++){ for(int f=0;f<10;f++){ xx+=i*(1<<10); yy+=f*(1<<10); if(xx>=n or yy>=n or xx>=yy){ xx-=i*(1<<10); yy-=f*(1<<10); continue; } dfs(xx,-1,0); for(int e=13;e>=0;e--){ if(((1<<e)&dist[yy])>0)res.push_back('1'); else res.push_back('0'); } xx-=i*(1<<10); yy-=f*(1<<10); } } return res; }
#include<bits/stdc++.h> #include "Benjamin.h" #define MAXN 10007 using namespace std; namespace{ int nn,from,to,s,pos,xx,yy; } string SendB(int N, int X, int Y){ nn=N; from=X; to=Y; if(from>to)swap(from,to); string res=""; for(int i=9;i>=0;i--){ if((from&(1<<i))==0)res.push_back('0'); else res.push_back('1'); } for(int i=9;i>=0;i--){ if((to&(1<<i))==0)res.push_back('0'); else res.push_back('1'); } return res; } int Answer(string T){ xx=from&((1<<10)-1); yy=to&((1<<10)-1); for(int i=0;i<10;i++){ for(int f=0;f<10;f++){ xx+=i*(1<<10); yy+=f*(1<<10); if(xx>=nn or yy>=nn or xx>=yy){ xx-=i*(1<<10); yy-=f*(1<<10); continue; } if(xx==from and yy==to){ s=0; for(int e=pos;e<pos+14;e++){ s*=2; if(T[e]=='1')s++; } return s; } pos+=14; xx-=i*(1<<10); yy-=f*(1<<10); } } return -1; }

Compilation message (stderr)

Ali.cpp: In function 'void {anonymous}::dfs(int, int, int)':
Ali.cpp:17:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for(int i=0;i<v[x].size();i++){
      |                     ~^~~~~~~~~~~~
Ali.cpp: At global scope:
Ali.cpp:10:10: warning: '{anonymous}::dali' defined but not used [-Wunused-variable]
   10 |     bool dali;
      |          ^~~~
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...