Submission #596316

#TimeUsernameProblemLanguageResultExecution timeMemory
596316ibm2006Flights (JOI22_flights)C++17
Compilation error
0 ms0 KiB
#include "Ali.h"
#include <string>
#include <vector>
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
pair<ll,ll> p[110000];
ll x,y;
void Init(int N, std::vector<int> U, std::vector<int> V) {
  ll i;
  for(i=0;i<N;i++)
    SetID(i,i);
    for(i=0;i<(n-1);i++)
    {
        p[i]={U[i],V[i]};
    }
}
string s;
string SendA(string S) {
  for(i=0;i<(n-1);i++)
  {
      x=p[i].first;
      y=8192;
      for(j=0;j<15;j++)
      {
          if(x/y%2==0)
            s+="0";
          else
            s+="1";
          y/=2;
      }
      y=8192;
      x=p[i].second;
      for(j=0;j<15;j++)
      {
           if(x/y%2==0)
            s+="0";
          else
            s+="1";
          y/=2;
      }
  }
  return s;
}
#include "Benjamin.h"
#include <string>
#include <vector>
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
ll x,y,n,k,z,w,h[110000],i,j;
vector<ll> v[110000];
string SendB(int N, int X, int Y) {
  x=X;  y=Y;  n=N;
  return "00000111110000011111";
}
string s;
ll f(ll x,ll z)
{
    ll i,w;
    for(i=0;i<h[x];i++)
    {
        if(v[x][i]==z)
            continue;
        w=f(v[x][i],x);
        if(w!=-1)
            return w+1;
    }
    return -1;
}
int Answer(string T) {
  s=T;
  for(i=0;i<(n-1);i++)
  {
      z=0;
      for(j=0;j<15;j++)
      {
          z=z*2+s[i*30+j]-'0';
      }
      w=0;
      for(j=0;j<15;j++)
      {
          w=w*2+s[i*30+15+j]-'0';
      }
      v[z].push_back(w);
      v[w].push_back(z);
  }
  for(i=0;i<n;i++)
    h[i]=v[i].size();
  return f(x,-1);
}

Compilation message (stderr)

Ali.cpp: In function 'void Init(int, std::vector<int>, std::vector<int>)':
Ali.cpp:11:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   11 |   for(i=0;i<N;i++)
      |   ^~~
Ali.cpp:13:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   13 |     for(i=0;i<(n-1);i++)
      |     ^~~
Ali.cpp:13:16: error: 'n' was not declared in this scope
   13 |     for(i=0;i<(n-1);i++)
      |                ^
Ali.cpp: In function 'std::string SendA(std::string)':
Ali.cpp:20:7: error: 'i' was not declared in this scope
   20 |   for(i=0;i<(n-1);i++)
      |       ^
Ali.cpp:20:14: error: 'n' was not declared in this scope
   20 |   for(i=0;i<(n-1);i++)
      |              ^
Ali.cpp:24:11: error: 'j' was not declared in this scope
   24 |       for(j=0;j<15;j++)
      |           ^
Ali.cpp:34:11: error: 'j' was not declared in this scope
   34 |       for(j=0;j<15;j++)
      |           ^
grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~