Submission #719767

#TimeUsernameProblemLanguageResultExecution timeMemory
719767lamFlights (JOI22_flights)C++17
15 / 100
51 ms3608 KiB
#include "Ali.h"
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
namespace {

int variable_example = 0;

}

const int maxn = 1e5 + 10;
int n;
vector <int> adj[maxn];
int d[maxn];

void Init(int N, std::vector<int> U, std::vector<int> V) {
    n=N;
    vector <int> id;
  for (int i=0; i<n; i++)
  {
      adj[i].clear();
      id.push_back(i);
  }
  shuffle(id.begin(),id.end(),rng);
  for (int i=0; i<n; i++) SetID(i,id[i]);
  for (int i=0; i<n-1; i++)
  {
      int u,v; u=U[i]; v=V[i];
      u=id[u]; v=id[v];
      adj[u].push_back(v);
      adj[v].push_back(u);
  }
}

inline bool checkbit(int i, int j)
{
    return i>>j&1;
}

std::string SendA(std::string S) {
    int X,Y;
    X=Y=0;
    for (int i=0; i<14; i++) if (S[i]=='1') X|=(1<<i);
    queue<int> q;
    fill_n(d,n,-1);
    d[X]=0;
    q.push(X);
    while (!q.empty())
    {
        int u=q.front(); q.pop();
        for (int v:adj[u])
            if (d[v]==-1)
        {
            d[v]=d[u]+1;
            q.push(v);
        }
    }
    string ans="";
    for (int i=0; i<n; i++)
    {
        bool ccheck = 1;
        for (int j=0; j<6; j++)
        {
            int x = (S[j+14]=='1');
            if (checkbit(i,j)!=x) ccheck=0;
        }
        if (!ccheck) continue;
        for (int j=0; j<14; j++) if (checkbit(d[i],j)) ans+='1';
        else ans+='0';
    }
    return ans;
}
#include "Benjamin.h"
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

namespace {

int variable_example = 0;

}


int _n,_x,_y;

inline bool checkbit(int i, int j)
{
    return i>>j&1;
}

std::string SendB(int N, int X, int Y) {
    _n=N; _x=X; _y=Y;
    string S="";
    for (int i=0; i<14; i++) if (checkbit(X,i)) S+='1';
    else S+='0';
    for (int i=0; i<6; i++) if (checkbit(Y,i)) S+='1';
    else S+='0';
    return S;
}

int Answer(std::string T) {
  int temp = (_y>>6);
  int ans=0;
  for (int i=0; i<14; i++) if (T[temp*14+i]=='1') ans|=(1<<i);
  return ans;
}

Compilation message (stderr)

Ali.cpp:9:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    9 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~

Benjamin.cpp:9:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    9 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...