Submission #986317

#TimeUsernameProblemLanguageResultExecution timeMemory
986317PyqeParrots (IOI11_parrots)C++17
100 / 100
448 ms14792 KiB
#include "encoder.h" #include "encoderlib.h" #include "decoder.h" #include "decoderlib.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 "encoderlib.h" #include "decoder.h" #include "decoderlib.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:30:17: warning: unused variable 'k' [-Wunused-variable]
   30 |   long long i,j,k=0;
      |                 ^
encoder.cpp: At global scope:
encoder.cpp:11:26: warning: '{anonymous}::fq' defined but not used [-Wunused-variable]
   11 |  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:30:17: warning: unused variable 'k' [-Wunused-variable]
   30 |   long long i,j,k=0;
      |                 ^
decoder.cpp: At global scope:
decoder.cpp:46:7: warning: 'bool {anonymous}::chk(std::bitset<512>, std::bitset<512>)' defined but not used [-Wunused-function]
   46 |  bool chk(bitset<512> x,bitset<512> y)
      |       ^~~
decoder.cpp:28:14: warning: 'std::bitset<512> {anonymous}::sb(std::bitset<512>, std::bitset<512>)' defined but not used [-Wunused-function]
   28 |  bitset<512> sb(bitset<512> x,bitset<512> y)
      |              ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...