Submission #1023240

# Submission time Handle Problem Language Result Execution time Memory
1023240 2024-07-14T13:58:39 Z codefox Question (Grader is different from the original contest) (CEOI14_question_grader) C++14
Compilation error
0 ms 0 KB
#pragma GCC target("popcnt")   
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

vector<int> ps
bool done = true;

void init()
{
  ps.assign(923, 0);
  int k = 0;
  for (int j = 30; j < (1<<12); j++)
  {
    if (__builtin_popcount(j)==6)
    {
      k++;
      ps[k] = j;
    }
  }
  done = false;
}

int encode(int n, int a, int b)
{
  if (done) init();
  for (int h = 0; h< 12; h++)
  {
    if ((ps[a]&(1<<h)) && ((ps[b]&(1<<h))==0)) return h+1;
  }
}
#pragma GCC target("popcnt")    
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

vector<int> ps
bool done = true;

void init()
{
  ps.assign(923, 0);
  int k = 0;
  for (int j = 30; j < (1<<12); j++)
  {
    if (__builtin_popcount(j)==6)
    {
      k++;
      ps[k] = j;
    }
  }
  done = false;
}

int decode(int n, int q, int h) 
{
  if (done) init();
  h--;
  if (ps[q]&(1<<h)) return true;
  return false;
}

Compilation message

encoder.cpp:5:1: error: 'vector' does not name a type
    5 | vector<int> ps
      | ^~~~~~
encoder.cpp: In function 'void init()':
encoder.cpp:10:3: error: 'ps' was not declared in this scope
   10 |   ps.assign(923, 0);
      |   ^~
encoder.cpp:20:3: error: 'done' was not declared in this scope
   20 |   done = false;
      |   ^~~~
encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:25:7: error: 'done' was not declared in this scope
   25 |   if (done) init();
      |       ^~~~
encoder.cpp:28:10: error: 'ps' was not declared in this scope
   28 |     if ((ps[a]&(1<<h)) && ((ps[b]&(1<<h))==0)) return h+1;
      |          ^~
encoder.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
   30 | }
      | ^

decoder.cpp:5:1: error: 'vector' does not name a type
    5 | vector<int> ps
      | ^~~~~~
decoder.cpp: In function 'void init()':
decoder.cpp:10:3: error: 'ps' was not declared in this scope
   10 |   ps.assign(923, 0);
      |   ^~
decoder.cpp:20:3: error: 'done' was not declared in this scope
   20 |   done = false;
      |   ^~~~
decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:25:7: error: 'done' was not declared in this scope
   25 |   if (done) init();
      |       ^~~~
decoder.cpp:27:7: error: 'ps' was not declared in this scope
   27 |   if (ps[q]&(1<<h)) return true;
      |       ^~