답안 #565011

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
565011 2022-05-20T07:43:34 Z Majid 저장 (Saveit) (IOI10_saveit) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
 
//Types
using ll = long long;
using db = double;
 
//Vectors
#define pb push_back
#define sz(vec) ((ll)vec.size())
#define all(vec) vec.begin(), vec.end()
 
//things
#define f first
#define s second
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

vector<ll> connect[20007];
bool visited[1007][1007];
ll dist[1007][1007];

void bfs(int x){
    
    queue<ll> q;
    q.push(x);
    visited[x][x] = true;
    
    while(!q.empty()){
        
        ll u = q.front();
        q.pop();
        
        for(auto v: connect[u]){
            
            if(!visited[x][v]){
                
                dist[x][v] = dist[x][u] + 1;
                visited[x][v] = true;
                q.push(v);
            }
        }
    }
}

int encode(int n, int h, int p, int a[], int b[]){
	
        for(ll i = 0; i < p; i++){
            
            connect[a[i]].pb(b[i]);
            connect[b[i]].pb(a[i]);
        }
        
        for(ll i = 0; i < h; i++){
            
            bfs(i);
            
            for(ll j = 0; j < n; j++){
            
                for(ll bit = 0; bit <= 10; bit++){
                    
                    if(dist[i][j] & (1<<bit)){
                        
                        encode_bit(1);
                    }
                }
                // cout<<dist[i][j]<<" ";
            }
            // cout<<"\n";
        }
        
        // for(ll j = 0; j < n; j++){
        // 
        //     cout<<dist[i][j]<<" ";
        // }
        // cout<<"\n";
        
}

// int a[7] = {0, 0, 0, 0, 1, 1, 1};
// int b[7] = {1, 2, 3, 4, 2, 3, 4}; 
// 
// int main(){
// 
//     encode(5, 3, 7, a, b);
// }
#include<bits/stdc++.h>
using namespace std;
 
//Types
using ll = long long;
using db = double;
 
//Vectors
#define pb push_back
#define sz(vec) ((ll)vec.size())
#define all(vec) vec.begin(), vec.end()
 
//things
#define f first
#define s second
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);

void decode(int n, int h){
    
        for(ll i = 0; i < n; i++){
            
            for(ll j = 0; j < h; j++){
                
                ll val = 0;
                
                for(ll bit = 0; bit <= 10; bit++){
                    
                    val+=(decode_bit() * (1<<bit));
                }
                hops(j, i, val);
            }
        }
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int, int*, int*)':
encoder.cpp:65:25: error: 'encode_bit' was not declared in this scope; did you mean 'encode'?
   65 |                         encode_bit(1);
      |                         ^~~~~~~~~~
      |                         encode
encoder.cpp:79:1: warning: no return statement in function returning non-void [-Wreturn-type]
   79 | }
      | ^

decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:30:27: error: 'decode_bit' was not declared in this scope; did you mean 'decode'?
   30 |                     val+=(decode_bit() * (1<<bit));
      |                           ^~~~~~~~~~
      |                           decode
decoder.cpp:32:17: error: 'hops' was not declared in this scope
   32 |                 hops(j, i, val);
      |                 ^~~~