Submission #587679

#TimeUsernameProblemLanguageResultExecution timeMemory
587679LastRoninFlights (JOI22_flights)C++17
0 / 100
7 ms1388 KiB
#include "Ali.h" #include <string> #include <vector> #include <queue> using namespace std; vector<vector<int>> g; int n; void Init(int N, std::vector<int> U, std::vector<int> V) { n = N; g.clear(); for(int j = 0; j < n; j++) { vector<int> a; g.push_back(a); } for(int j = 0; j < U.size(); j++) { g[U[j]].push_back(V[j]); g[V[j]].push_back(U[j]); } for(int i = 0; i < n; i++) SetID(i, i); } std::string SendA(std::string S) { int v = 0; for(int j = 0; j < S.size(); j++) { if(S[j] == '1') v += (1<<j); } int dist[n] = {0}; for(int i = 0; i < n; i++) dist[i] = -1; queue<int> q; dist[v] = 0; q.push(v); while(q.size()) { int a = q.front(); q.pop(); for(auto u : g[a]) { if(dist[u] == -1) { dist[u] = dist[a] + 1; q.push(u); } } } string a; for(int j = 0; j < n; j++) { for(int i = 0; i < 20; i++) { if((1ll<<i)&dist[j])a += "1"; else a += "0"; } } return a; }
#include "Benjamin.h" #include <string> #include <vector> using namespace std; int n, x, y; string SendB(int N, int X, int Y) { x = X; y = Y; n = N; string a; for(int j = 0; j < 20; j++) { if((1ll<<j)&x)a += "1"; else a += "0"; } return a; } int Answer(string T) { int pos = 0; int answ = 0; for(int j = 0, px = 0; j < n; j++, px += 20) { int dist = 0; for(int x = 0; x < 20; x++) { if(px + x < T.size() && T[px + x] == '1') dist += (1ll<<x); } if(j == y) { answ = dist; break; } } return answ; }

Compilation message (stderr)

Ali.cpp: In function 'void Init(int, std::vector<int>, std::vector<int>)':
Ali.cpp:18:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |  for(int j = 0; j < U.size(); j++) {
      |                 ~~^~~~~~~~~~
Ali.cpp: In function 'std::string SendA(std::string)':
Ali.cpp:28:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  for(int j = 0; j < S.size(); j++) {
      |                 ~~^~~~~~~~~~
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:27:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |    if(px + x < T.size() && T[px + x] == '1')
      |       ~~~~~~~^~~~~~~~~~
Benjamin.cpp:22:6: warning: unused variable 'pos' [-Wunused-variable]
   22 |  int pos = 0;
      |      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...