제출 #124370

#제출 시각아이디문제언어결과실행 시간메모리
124370nxteru앵무새 (IOI11_parrots)C++14
17 / 100
9 ms1872 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; typedef unsigned long long ull; void encode(int n, int m[]){ ull dp[40][32],rs=0; for(int i=0;i<32;i++)dp[0][i]=1; for(int i=0;i<40;i++){ for(int j=0;j<32;j++){ if(i)dp[i][j]=dp[i-1][j]; if(j)dp[i][j]+=dp[i][j-1]; } } for(int i=0;i<n;i+=8){ ull s=0,p=0; for(int j=i;j<n&&j<i+8;j++,p++){ s*=256ULL; s+=ull(m[j]); } p*=5; s++; for(int j=p-1;j>=0;j--){ for(int k=0;k<min(256-rs,32ULL);k++){ if(dp[j][k]>=s){ send(rs+k); if(k>0)s-=dp[j][k-1]; break; } } } rs+=32; } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; typedef long long ull; void decode(int n, int l, int x[]){ ull dp[40][32],rs=0,xs=0; sort(x,x+l); for(int i=0;i<32;i++)dp[0][i]=1; for(int i=0;i<40;i++){ for(int j=0;j<32;j++){ if(i)dp[i][j]=dp[i-1][j]; if(j)dp[i][j]+=dp[i][j-1];; } } for(int i=0;i<n;i+=8){ ull s=0,p=0; for(int j=i;j<n&&j<i+8;j++,p++); p*=5; for(int j=p-1;j>=0;j--)if(x[xs+j]-rs>0)s+=dp[j][x[xs+j]-rs-1]; xs+=p; rs+=32; p/=5; for(int i=p-1;i>=0;i--)output((s>>(i*8))&255ULL); } }

컴파일 시 표준 에러 (stderr) 메시지

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:24:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int k=0;k<min(256-rs,32ULL);k++){
                ~^~~~~~~~~~~~~~~~~~
#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...