Submission #587669

#TimeUsernameProblemLanguageResultExecution timeMemory
587669LastRoninFlights (JOI22_flights)C++17
0 / 100
10 ms1452 KiB
#include "Ali.h" #include <string> #include <vector> #include <bits/stdc++.h> #define ll long long #define pb push_back using namespace std; const ll N = 1e4 + 10; namespace { vector<ll> g[N]; ll dist[N] = {0}; ll n; } void Init(int N, std::vector<int> U, std::vector<int> V) { n = N; for(int j = 0; j < n; j++) g[j].clear(); for(int j = 0; j < U.size(); j++) { g[U[j]].pb(V[j]); g[V[j]].pb(U[j]); } for(int i = 0; i < N; i++) SetID(i, i); } std::string SendA(std::string S) { ll v = 0, u = 0; for(int j = 0; j <= 13; j++) { if(S[j] == '1') v += (1<<j); } for(int i = 0; i < n; i++) dist[i] = -1; queue<int> q; dist[v] = 0; q.push(v); while(q.size()) { ll 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 < 14; i++) { if((1ll<<i)&dist[j])a += "1"; else a += "0"; } } return a; }
#include "Benjamin.h" #include <string> #include <vector> #include <bits/stdc++.h> #define ll long long #define pb push_back using namespace std; namespace { 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 < 14; j++) { if((1ll<<j)&x)a += "1"; else a += "0"; } while(a.size() != 20)a += "0"; return a; } int Answer(string T) { if(T.size() != 14 * n)return 0; int pos = 0; int answ = -1; for(int j = 0; j < n; j++) { if(j == y) { answ = 0; string ss = T.substr(pos, 14); for(int i = 0; i < 14; i++) { if(ss[i] == '1') { answ += (1ll<<i); } } pos += 14; break; } else { pos += 14; } } if(answ >= 0 && answ < n)return answ; exit(0); return 0; }

Compilation message (stderr)

Ali.cpp: In function 'void Init(int, std::vector<int>, std::vector<int>)':
Ali.cpp:22:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  for(int j = 0; j < U.size(); j++) {
      |                 ~~^~~~~~~~~~
Ali.cpp: In function 'std::string SendA(std::string)':
Ali.cpp:31:12: warning: unused variable 'u' [-Wunused-variable]
   31 |  ll v = 0, u = 0;
      |            ^
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:28:14: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |  if(T.size() != 14 * n)return 0;
      |     ~~~~~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...