답안 #923512

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
923512 2024-02-07T11:06:22 Z bachhoangxuan 앵무새 (IOI11_parrots) C++17
컴파일 오류
0 ms 0 KB
#include "encoder.h"
#include "encoderlib.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define fi first
#define se second
const int maxa = 256;
const int Max = 35;
const int Lim = 27;
ll dp[55][55];


void encode(int N, int M[])
{
    dp[0][0]=1;
    for(int i=0;i<Max;i++){
        for(int j=0;j<Lim;j++){
            if(i) dp[i][j]+=dp[i-1][j];
            if(j) dp[i][j]+=dp[i][j-1];
        }
    }
    int cur=0;
    for(int i=0;i<N;i+=7){
        ll num=0,mul=1;
        int cnt=0;
        for(int j=i;j<min(i+7,N);j++){
            num+=1LL*M[j]*mul,mul*=maxa,cnt++;
        }
        for(int j=cnt*5-1;j>=0;j--){
            for(int k=0;k<min(maxa-cur,Lim);k++){
                if(dp[j][k]>num){
                    if(k) num-=dp[j][k-1];
                    send(cur+k);
                    break;
                }
            }
        }
        cur+=Lim;
    }
}
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
using namespace std;
const int maxa = 256;
const int Max = 35;
const int Lim = 27;
ll dp[55][55];

void decode(int N, int L, int X[])
{
    dp[0][0]=1;
    for(int i=0;i<Max;i++){
        for(int j=0;j<Lim;j++){
            if(i) dp[i][j]+=dp[i-1][j];
            if(j) dp[i][j]+=dp[i][j-1];
        }
    }
    vector<vector<int>> d(N);
    for(int i=0;i<L;i++) d[X[i]/Lim].push_back(X[i]%Lim);
    for(int i=0;i<N;i++){
        if(d[i].empty()) continue;
        sort(d[i].begin(),d[i].end());
        ll num=0;
        for(int j=(int)d[i].size()-1;j>=0;j--){
            int k=d[i][j];
            if(k) num+=dp[j][k-1];
        }
        for(int j=i*7;j<min((i+1)*7,N);j++){
            output(num%maxa);
            num/=maxa;
        }
    }
}

Compilation message

decoder.cpp:8:1: error: 'll' does not name a type
    8 | ll dp[55][55];
      | ^~
decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:12:5: error: 'dp' was not declared in this scope
   12 |     dp[0][0]=1;
      |     ^~
decoder.cpp:24:9: error: 'll' was not declared in this scope
   24 |         ll num=0;
      |         ^~
decoder.cpp:27:19: error: 'num' was not declared in this scope; did you mean 'enum'?
   27 |             if(k) num+=dp[j][k-1];
      |                   ^~~
      |                   enum
decoder.cpp:30:20: error: 'num' was not declared in this scope; did you mean 'enum'?
   30 |             output(num%maxa);
      |                    ^~~
      |                    enum