Submission #587593

#TimeUsernameProblemLanguageResultExecution timeMemory
587593TekorFlights (JOI22_flights)C++17
15 / 100
42 ms1604 KiB
#include "Ali.h" #include <string> #include <vector> namespace { int variable_example = 0; } #include <bits/stdc++.h> using namespace std; #define pb push_back const int M = 2e4 + 100; int n; vector <int> g[M]; bool u[M]; int d[M]; void Init(int NN, std::vector<int> U, std::vector<int> V) { n = NN; for(int i = 0;i < n;i++) { g[i].clear(); u[i] = 0; d[i] = 0; SetID(i,i); } for(int i = 0;i < U.size();i++) { g[U[i]].pb(V[i]); g[V[i]].pb(U[i]); } } void bfs(int x) { deque <int> q; u[x] = 1; q.pb(x); while(!q.empty()) { int v = q.front(); q.pop_front(); for(auto to : g[v]) { if(u[to])continue; d[to] = d[v] + 1; u[to] = 1; q.pb(to); } } } string trans(int x) { string tek; for(int i = 0;i <= 13;i++) { if(x & (1 << i))tek += "1"; else tek += "0"; } return tek; } string SendA(string S) { int tek = 1,st = 0; for(int i = 0;i <= 13;i++) { if(S[i] == '1')st += tek; tek *= 2; } tek = 1; int fin = 0; for(int i = 14;i < 20;i++) { if(S[i] == '1')fin += tek; tek *= 2; } bfs(st); string ans; for(int i = 0;i < n;i++) { bool ch = 0; for(int j = 0;j < 6;j++) { if(((i & (1 << j)) && S[j + 14] == '0') || (!(i & (1 << j)) && S[j + 14] == '1')) { ch = 1; break; } } if(!ch)ans += trans(d[i]); } return ans; }
#include "Benjamin.h" #include <string> #include <vector> namespace { int variable_example = 0; } #include <bits/stdc++.h> using namespace std; string transf(int x) { string tek; for(int i = 0;i <= 13;i++) { if(x & (1 << i))tek += "1"; else tek += "0"; } return tek; } int star,finf,n; std::string SendB(int NN, int X, int Y) { n = NN; star = X; finf = Y; string val = transf(X); string val1 = transf(Y); for(int i = 0;i < 6;i++) { val += val1[i]; } return val; } int Answer(std::string T) { string val1 = transf(finf); int L = 0; for(int i = 0;i < n;i++) { bool ch = 0; for(int j = 0;j < 6;j++) { if(((i & (1 << j)) && val1[j] == '0') || (!(i & (1 << j)) && val1[j] == '1')) { ch = 1; break; } } if(ch)continue; if(i == finf) { int val = 0,tek = 1; for(int j = L;j < L + 14;j++) { if(T[j] == '1')val += tek; tek = (tek * 2); } return val; } L += 14; } }

Compilation message (stderr)

Ali.cpp: In function 'void Init(int, std::vector<int>, std::vector<int>)':
Ali.cpp:27:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |  for(int i = 0;i < U.size();i++) {
      |                ~~^~~~~~~~~~
Ali.cpp: At global scope:
Ali.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 | int variable_example = 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:34:27: warning: control reaches end of non-void function [-Wreturn-type]
   34 |  string val1 = transf(finf);
      |                           ^
Benjamin.cpp: At global scope:
Benjamin.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...