Submission #567771

#TimeUsernameProblemLanguageResultExecution timeMemory
567771jamezzzFlights (JOI22_flights)C++17
Compilation error
0 ms0 KiB
#include "Ali.h" #include <string> #include <vector> #include <bits/stdc++.h> using namespace std; namespace { int nn; int dist[10005]; vector<int> AL[10005]; void dfs(int u){ for(int v:AL[u]){ if(dist[v]!=-1)continue; dist[v]=dist[u]+1; dfs(v); } } } void Init(int N, vector<int> U, vector<int> V){ nn=N; for(int i=0;i<N;++i){ AL[i].clear(); } memset(dist,-1,sizeof dist); for(int i=0;i<N-1;++i){ AL[U[i]].push_back(V[i]); AL[V[i]].push_back(U[i]); } for(int i=0;i<N;++i)SetID(i,i); } string SendA(string S){ int X=0,Y=0; for(int i=0;i<14;++i){ if(S[i]=='1')X+=(1<<i); } for(int i=0;i<6;++i){ if(S[i+14]=='1')Y+=(1<<i); } dist[X]=0;dfs(X); string ret; for(int i=0;i<=nn/64;++i){ int u=64*i+Y; for(int i=0;i<14;++i){ if((dist[u]&(1<<i))!=0)ret+='1'; else ret+='0'; } } assert(strlen(ret)<=300000); return ret; }
#include "Benjamin.h" #include <string> #include <vector> #include <bits/stdc++.h> using namespace std; namespace { int yy; } string SendB(int N, int X, int Y){ yy=Y; string s; for(int i=0;i<14;++i){ if((X&(1<<i))!=0)s+='1'; else s+='0'; } for(int i=0;i<6;++i){ if((Y&(1<<i))!=0)s+='1'; else s+='0'; } return s; } int Answer(string T){ yy/=64; int ans=0; for(int i=yy*14;i<(yy+1)*14;++i){ if(T[i]=='1')ans+=(1<<i); } return ans; }

Compilation message (stderr)

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from Ali.cpp:4:
Ali.cpp: In function 'std::string SendA(std::string)':
Ali.cpp:54:16: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   54 |  assert(strlen(ret)<=300000);
      |                ^~~
      |                |
      |                std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/10/cstring:42,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:48,
                 from Ali.cpp:4:
/usr/include/string.h:385:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  385 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~