답안 #564999

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
564999 2022-05-20T07:26:55 Z birthdaycake 저장 (Saveit) (IOI10_saveit) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;

int dis[1001][37];
vector<int>adj[1001];




void reset(int n, int h){
    for(int i = 0; i < n; i++){
        adj[i].clear();
        for(int j = 0; j < h; j++) dis[i][j] = INT_MAX;
    }
}



void encode(int n, int h, int p, int a[], int b[]){
    
    
    reset(n,h);
    
    
    for(int i = 0; i < p; i++){
        adj[a[i]].push_back(b[i]);
        adj[b[i]].push_back(a[i]);
    }
    
    for(int i = 0; i < h; i++){
        dis[i][i] = 0;
        set<pair<int,int>>bfs;
        bfs.insert({0,i});
        while(bfs.size()){
            auto x = *bfs.begin();
            bfs.erase(x);
            if(dis[x.second][i] < x.first) continue;
            for(auto s:adj[x.second]){
                if(dis[x.second][i] + 1 < dis[s][i]){
                    dis[s][i] = dis[x.second][i]+ 1;
                    bfs.insert({dis[x.second][i] + 1, s});
                }
            }
        }
    }
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < h; j++){
            for(int k = 0; k < 10; k++){
                if(dis[i][j] & (1 << k)) encode_bit(1);
                else encode_bit(0);
            }
        }
    }
    
    
    
    
}

#include<bits/stdc++.h>
using namespace std;

int dis[1001][37];

void reset(int n, int h){
    for(int i = 0; i < n; i++){
        for(int j = 0; j < h; j++) dis[i][j] = 0;
    }
}


int decode(int n, int h){
    
    reset(n,h);
    
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < h; j++){
            for(int k = 0; k < 10; k++){
                dis[i][j] += (1 << decode_bit());
            }
        }
    }
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < h; j++){
            hops(j,i,dis[i][j]);
        }
    }
}

Compilation message

encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:50:42: error: 'encode_bit' was not declared in this scope; did you mean 'encode'?
   50 |                 if(dis[i][j] & (1 << k)) encode_bit(1);
      |                                          ^~~~~~~~~~
      |                                          encode
encoder.cpp:51:22: error: 'encode_bit' was not declared in this scope; did you mean 'encode'?
   51 |                 else encode_bit(0);
      |                      ^~~~~~~~~~
      |                      encode

decoder.cpp: In function 'int decode(int, int)':
decoder.cpp:21:36: error: 'decode_bit' was not declared in this scope; did you mean 'decode'?
   21 |                 dis[i][j] += (1 << decode_bit());
      |                                    ^~~~~~~~~~
      |                                    decode
decoder.cpp:28:13: error: 'hops' was not declared in this scope
   28 |             hops(j,i,dis[i][j]);
      |             ^~~~
decoder.cpp:31:1: warning: no return statement in function returning non-void [-Wreturn-type]
   31 | }
      | ^