Submission #986316

#TimeUsernameProblemLanguageResultExecution timeMemory
986316PyqeParrots (IOI11_parrots)C++17
Compilation error
0 ms0 KiB
#include "encoder.h" #include "decoder.h" #include <bits/stdc++.h> using namespace std; namespace { long long mxn=64,ma=256,fq[256]; bitset<512> a,cb[256][369]; bool alr=0; bitset<512> ad(bitset<512> x,bitset<512> y) { long long i,k=0; for(i=0;i<mxn*8;i++) { k+=x[i]+y[i]; x[i]=k&1; k>>=1; } return x; } bitset<512> sb(bitset<512> x,bitset<512> y) { long long i,j,k=0; for(i=mxn*8-1;i+1;i--) { if(y[i]) { for(j=i;!x[j];j++) { x[j]=1; } x[j]=0; } } return x; } bool chk(bitset<512> x,bitset<512> y) { long long i; for(i=mxn*8-1;i+1;i--) { if(x[i]<y[i]) { return 1; } else if(x[i]>y[i]) { return 0; } } return 0; } void bd() { long long i,j; alr=1; cb[0][0][0]=1; for(i=1;i<ma;i++) { for(j=0;j<=mxn*5;j++) { cb[i][j]=cb[i-1][j]; if(j) { cb[i][j]=ad(cb[i][j],cb[i][j-1]); } } } } } void encode(int n,int aa[]) { long long i,j,sm=n*5; if(!alr) { bd(); } for(i=0;i<n;i++) { for(j=0;j<8;j++) { a[i*8+j]=aa[i]&1; aa[i]>>=1; } } for(i=0;i<ma;i++) { for(j=0;!chk(a,cb[ma-i-1][sm]);j++) { a=sb(a,cb[ma-i-1][sm]); sm--; } for(;j;j--) { send(i); } } }
#include "encoder.h" #include "decoder.h" #include <bits/stdc++.h> using namespace std; namespace { long long mxn=64,ma=256,fq[256]; bitset<512> a,cb[256][369]; bool alr=0; bitset<512> ad(bitset<512> x,bitset<512> y) { long long i,k=0; for(i=0;i<mxn*8;i++) { k+=x[i]+y[i]; x[i]=k&1; k>>=1; } return x; } bitset<512> sb(bitset<512> x,bitset<512> y) { long long i,j,k=0; for(i=mxn*8-1;i+1;i--) { if(y[i]) { for(j=i;!x[j];j++) { x[j]=1; } x[j]=0; } } return x; } bool chk(bitset<512> x,bitset<512> y) { long long i; for(i=mxn*8-1;i+1;i--) { if(x[i]<y[i]) { return 1; } else if(x[i]>y[i]) { return 0; } } return 0; } void bd() { long long i,j; alr=1; cb[0][0][0]=1; for(i=1;i<ma;i++) { for(j=0;j<=mxn*5;j++) { cb[i][j]=cb[i-1][j]; if(j) { cb[i][j]=ad(cb[i][j],cb[i][j-1]); } } } } } void decode(int n,int m,int aa[]) { long long i,j,k,sm=n*5; if(!alr) { bd(); } for(i=0;i<m;i++) { fq[aa[i]]++; } for(i=0;i<ma;i++) { for(j=0;j<fq[i];j++) { a=ad(a,cb[ma-i-1][sm]); sm--; } fq[i]=0; } for(i=0;i<n;i++) { k=0; for(j=0;j<8;j++) { k|=a[i*8+j]<<j; a[i*8+j]=0; } output(k); } }

Compilation message (stderr)

encoder.cpp: In function 'std::bitset<512> {anonymous}::sb(std::bitset<512>, std::bitset<512>)':
encoder.cpp:28:17: warning: unused variable 'k' [-Wunused-variable]
   28 |   long long i,j,k=0;
      |                 ^
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:107:4: error: 'send' was not declared in this scope
  107 |    send(i);
      |    ^~~~
encoder.cpp: At global scope:
encoder.cpp:9:26: warning: '{anonymous}::fq' defined but not used [-Wunused-variable]
    9 |  long long mxn=64,ma=256,fq[256];
      |                          ^~

decoder.cpp: In function 'std::bitset<512> {anonymous}::sb(std::bitset<512>, std::bitset<512>)':
decoder.cpp:28:17: warning: unused variable 'k' [-Wunused-variable]
   28 |   long long i,j,k=0;
      |                 ^
decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:111:3: error: 'output' was not declared in this scope
  111 |   output(k);
      |   ^~~~~~
decoder.cpp: At global scope:
decoder.cpp:44:7: warning: 'bool {anonymous}::chk(std::bitset<512>, std::bitset<512>)' defined but not used [-Wunused-function]
   44 |  bool chk(bitset<512> x,bitset<512> y)
      |       ^~~
decoder.cpp:26:14: warning: 'std::bitset<512> {anonymous}::sb(std::bitset<512>, std::bitset<512>)' defined but not used [-Wunused-function]
   26 |  bitset<512> sb(bitset<512> x,bitset<512> y)
      |              ^~