Submission #564832

# Submission time Handle Problem Language Result Execution time Memory
564832 2022-05-19T18:47:11 Z Uzouf Question (Grader is different from the original contest) (CEOI14_question_grader) C++14
Compilation error
0 ms 0 KB
int encode(int n,int x,int y) {
        bitset<10> a=x,b=y;
        int h=-1;
        for (int p=10;p>=0;p--) {
          if (a[p]>b[p]) {h=p+1; break;}
        }
        if (h==-1) {
          int pa=__builtin_popcount(i),pb=__builtin_popcount(j);
          a=pa; b=pb;
          for (int p=4;p>=0;p--) {
            if (b[p]>a[p]) {h=11+p; break;}
          }
        }
  return h;
}
int decode(int n,int q,int h) {
  if (h>10) {
    h-=10;
    int nm=__builtin_popcount(q);
    bitset<5> st=nm;
    if (st[h]==1) return 0;
    else return 1;
  }
  else {
    bitset<10> k=q;
    if (k[h]==0) return 0;
    else return 1;
  }
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:2:9: error: 'bitset' was not declared in this scope
    2 |         bitset<10> a=x,b=y;
      |         ^~~~~~
encoder.cpp:2:20: error: 'a' was not declared in this scope
    2 |         bitset<10> a=x,b=y;
      |                    ^
encoder.cpp:2:24: error: 'b' was not declared in this scope
    2 |         bitset<10> a=x,b=y;
      |                        ^
encoder.cpp:8:37: error: 'i' was not declared in this scope
    8 |           int pa=__builtin_popcount(i),pb=__builtin_popcount(j);
      |                                     ^
encoder.cpp:9:19: error: 'pb' was not declared in this scope; did you mean 'pa'?
    9 |           a=pa; b=pb;
      |                   ^~
      |                   pa

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:5:5: error: 'bitset' was not declared in this scope
    5 |     bitset<5> st=nm;
      |     ^~~~~~
decoder.cpp:5:15: error: 'st' was not declared in this scope; did you mean 'std'?
    5 |     bitset<5> st=nm;
      |               ^~
      |               std
decoder.cpp:10:5: error: 'bitset' was not declared in this scope
   10 |     bitset<10> k=q;
      |     ^~~~~~
decoder.cpp:10:16: error: 'k' was not declared in this scope
   10 |     bitset<10> k=q;
      |                ^
decoder.cpp:14:1: warning: control reaches end of non-void function [-Wreturn-type]
   14 | }
      | ^