Submission #565119

# Submission time Handle Problem Language Result Execution time Memory
565119 2022-05-20T10:03:52 Z Dodo Saveit (IOI10_saveit) C++14
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"
using namespace std;
#include "grader.h"
#include "encoder.h"


void encode(int n, int h, int p, int a[], int b[]){

  map<pair<int,int>,bool>mp;

  for(int i=0;i<p;i++)
    mp[{a[i],b[i]}]=1;

  for(int i=0;i<h;i++)
  {
    for(int j=0;j<n;j++)
    {
      if(mp[{i,j}]||mp[{j,i}])encode_bit(1);
      else encode_bit(0);
    }
  }
  return;
}
#include "bits/stdc++.h"
using namespace std;
#include "grader.h"
#include "encoder.h"

void decode(int n, int h) {
  vector<ll>v[n];
   for(int i=0;i<h;i++)
   {
     for(int j=0;j<n;j++)
     {
       int a = decode_bit();
       if(a==1)
       {
         v[i].push_back(j);
         v[j].push_back(i);
       }
     }
   }

   for(int i=0;i<h;i++)
   {
     deque<ll>q;
     ll vis[n]={};
     vis[i]=1;
     q.push_back(i);
     while(!q.empty())
     {
       ll x=q.front();
       q.pop_front();
       for(auto u:v[x])
       {
         if(vis[u]==0)
         {
           vis[u]=vis[x]+1;
           q.push_back(u);
         }
       }
     }
     for(int j=0;j<n;j++)
     {
       hops(i,j,vis[j]-1);
     }
   }
}

Compilation message

decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:7:10: error: 'll' was not declared in this scope
    7 |   vector<ll>v[n];
      |          ^~
decoder.cpp:7:12: error: template argument 1 is invalid
    7 |   vector<ll>v[n];
      |            ^
decoder.cpp:7:12: error: template argument 2 is invalid
decoder.cpp:15:15: error: request for member 'push_back' in 'v[i]', which is of non-class type 'int'
   15 |          v[i].push_back(j);
      |               ^~~~~~~~~
decoder.cpp:16:15: error: request for member 'push_back' in 'v[j]', which is of non-class type 'int'
   16 |          v[j].push_back(i);
      |               ^~~~~~~~~
decoder.cpp:23:14: error: template argument 2 is invalid
   23 |      deque<ll>q;
      |              ^
decoder.cpp:24:8: error: expected ';' before 'vis'
   24 |      ll vis[n]={};
      |        ^~~~
      |        ;
decoder.cpp:25:6: error: 'vis' was not declared in this scope
   25 |      vis[i]=1;
      |      ^~~
decoder.cpp:26:8: error: request for member 'push_back' in 'q', which is of non-class type 'int'
   26 |      q.push_back(i);
      |        ^~~~~~~~~
decoder.cpp:27:15: error: request for member 'empty' in 'q', which is of non-class type 'int'
   27 |      while(!q.empty())
      |               ^~~~~
decoder.cpp:29:10: error: expected ';' before 'x'
   29 |        ll x=q.front();
      |          ^~
      |          ;
decoder.cpp:30:10: error: request for member 'pop_front' in 'q', which is of non-class type 'int'
   30 |        q.pop_front();
      |          ^~~~~~~~~
decoder.cpp:31:21: error: 'x' was not declared in this scope
   31 |        for(auto u:v[x])
      |                     ^
decoder.cpp:36:14: error: request for member 'push_back' in 'q', which is of non-class type 'int'
   36 |            q.push_back(u);
      |              ^~~~~~~~~