답안 #565152

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
565152 2022-05-20T11:00:29 Z MrDeboo 저장 (Saveit) (IOI10_saveit) C++17
0 / 100
197 ms 10396 KB
#include "grader.h"
#include "encoder.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int n, int h, int p, int v1[], int v2[]){
    srand(time(NULL));
    vector<int>vct[n];
    for(int i=0;i<p;i++){
        vct[v1[i]].push_back(v2[i]);
        vct[v2[i]].push_back(v1[i]);
    }
    priority_queue<pair<int,pair<int,int>>>pq;
    map<pair<int,int>,bool>mp;
    for(int i=0;i<10;i++){
        int k=rand()%n;
        deque<pair<int,int>>dq={{0,i}};
        vector<bool>vis(n);
        while(dq.size()){
            pair<int,int>p=dq.front();
            dq.pop_front();
            for(auto &w:vct[p.second]){
                if(vis[w])continue;
                vis[w]=1;
                if(!mp[{min(w,p.second),max(w,p.second)}]){
                    pq.push({rand(),{min(w,p.second),max(w,p.second)}});
                    mp[{min(w,p.second),max(w,p.second)}]=1;
                }
                dq.push_back({p.first+1,w});
            }
        }
    }
    int tot=80000/20;
    while(tot--){
        pair<int,int>pr;
        if(pq.empty())pr={0,0};
        else{
            pr=pq.top().second;
            pq.pop();
        }
        for(int i=0;i<10;i++)encode_bit((!!(pr.first&(1<<i))));
        for(int i=0;i<10;i++)encode_bit((!!(pr.second&(1<<i))));
    }
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int n, int h) {
    vector<int>vct[n];
    for(int i=0;i<80000/20;i++){
        int a=0,b=0;
        for(int w=0;w<10;w++)a+=(1<<w)*decode_bit();
        for(int w=0;w<10;w++)b+=(1<<w)*decode_bit();
        vct[a].push_back(b);
        vct[b].push_back(a);
    }
    for(int i=0;i<h;i++){
        deque<pair<int,int>>dq={{0,i}};
        vector<bool>vis(n);
        vis[i]=1;
        while(dq.size()){
            pair<int,int>p=dq.front();
            dq.pop_front();
            hops(i,p.second,p.first);
            for(auto &w:vct[p.second]){if(!vis[w]){dq.push_back({p.first+1,w});vis[w]=1;}}
        }
    }
}

Compilation message

encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:15:13: warning: unused variable 'k' [-Wunused-variable]
   15 |         int k=rand()%n;
      |             ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 197 ms 10396 KB function hops(h,c,d) must be called exactly N×H times
2 Runtime error 2 ms 464 KB Execution killed with signal 11
3 Incorrect 28 ms 5728 KB Output isn't correct
4 Runtime error 2 ms 464 KB Execution killed with signal 11
5 Incorrect 38 ms 5952 KB Output isn't correct
6 Incorrect 27 ms 5964 KB function hops(h,c,d) must be called exactly N×H times
7 Incorrect 39 ms 6540 KB function hops(h,c,d) must be called exactly N×H times
8 Incorrect 27 ms 5632 KB Output isn't correct
9 Incorrect 30 ms 5576 KB Output isn't correct
10 Incorrect 31 ms 5640 KB Output isn't correct
11 Incorrect 35 ms 5856 KB Output isn't correct
12 Correct 24 ms 5608 KB Output is partially correct - 80000 call(s) of encode_bit()
13 Incorrect 46 ms 6612 KB function hops(h,c,d) must be called exactly N×H times
14 Incorrect 27 ms 5668 KB Output isn't correct
15 Incorrect 26 ms 5852 KB Output isn't correct
16 Incorrect 46 ms 6292 KB Output isn't correct
17 Incorrect 38 ms 6124 KB Output isn't correct
18 Incorrect 49 ms 6500 KB function hops(h,c,d) must be called exactly N×H times
19 Incorrect 33 ms 6112 KB function hops(h,c,d) must be called exactly N×H times
20 Incorrect 55 ms 6724 KB function hops(h,c,d) must be called exactly N×H times
21 Incorrect 61 ms 7064 KB function hops(h,c,d) must be called exactly N×H times
22 Incorrect 44 ms 6632 KB function hops(h,c,d) must be called exactly N×H times
23 Incorrect 64 ms 7204 KB function hops(h,c,d) must be called exactly N×H times
# 결과 실행 시간 메모리 Grader output
1 Incorrect 197 ms 10396 KB function hops(h,c,d) must be called exactly N×H times
2 Runtime error 2 ms 464 KB Execution killed with signal 11
3 Incorrect 28 ms 5728 KB Output isn't correct
4 Runtime error 2 ms 464 KB Execution killed with signal 11
5 Incorrect 38 ms 5952 KB Output isn't correct
6 Incorrect 27 ms 5964 KB function hops(h,c,d) must be called exactly N×H times
7 Incorrect 39 ms 6540 KB function hops(h,c,d) must be called exactly N×H times
8 Incorrect 27 ms 5632 KB Output isn't correct
9 Incorrect 30 ms 5576 KB Output isn't correct
10 Incorrect 31 ms 5640 KB Output isn't correct
11 Incorrect 35 ms 5856 KB Output isn't correct
12 Correct 24 ms 5608 KB Output is partially correct - 80000 call(s) of encode_bit()
13 Incorrect 46 ms 6612 KB function hops(h,c,d) must be called exactly N×H times
14 Incorrect 27 ms 5668 KB Output isn't correct
15 Incorrect 26 ms 5852 KB Output isn't correct
16 Incorrect 46 ms 6292 KB Output isn't correct
17 Incorrect 38 ms 6124 KB Output isn't correct
18 Incorrect 49 ms 6500 KB function hops(h,c,d) must be called exactly N×H times
19 Incorrect 33 ms 6112 KB function hops(h,c,d) must be called exactly N×H times
20 Incorrect 55 ms 6724 KB function hops(h,c,d) must be called exactly N×H times
21 Incorrect 61 ms 7064 KB function hops(h,c,d) must be called exactly N×H times
22 Incorrect 44 ms 6632 KB function hops(h,c,d) must be called exactly N×H times
23 Incorrect 64 ms 7204 KB function hops(h,c,d) must be called exactly N×H times
# 결과 실행 시간 메모리 Grader output
1 Incorrect 197 ms 10396 KB function hops(h,c,d) must be called exactly N×H times
2 Runtime error 2 ms 464 KB Execution killed with signal 11
3 Incorrect 28 ms 5728 KB Output isn't correct
4 Runtime error 2 ms 464 KB Execution killed with signal 11
5 Incorrect 38 ms 5952 KB Output isn't correct
6 Incorrect 27 ms 5964 KB function hops(h,c,d) must be called exactly N×H times
7 Incorrect 39 ms 6540 KB function hops(h,c,d) must be called exactly N×H times
8 Incorrect 27 ms 5632 KB Output isn't correct
9 Incorrect 30 ms 5576 KB Output isn't correct
10 Incorrect 31 ms 5640 KB Output isn't correct
11 Incorrect 35 ms 5856 KB Output isn't correct
12 Correct 24 ms 5608 KB Output is partially correct - 80000 call(s) of encode_bit()
13 Incorrect 46 ms 6612 KB function hops(h,c,d) must be called exactly N×H times
14 Incorrect 27 ms 5668 KB Output isn't correct
15 Incorrect 26 ms 5852 KB Output isn't correct
16 Incorrect 46 ms 6292 KB Output isn't correct
17 Incorrect 38 ms 6124 KB Output isn't correct
18 Incorrect 49 ms 6500 KB function hops(h,c,d) must be called exactly N×H times
19 Incorrect 33 ms 6112 KB function hops(h,c,d) must be called exactly N×H times
20 Incorrect 55 ms 6724 KB function hops(h,c,d) must be called exactly N×H times
21 Incorrect 61 ms 7064 KB function hops(h,c,d) must be called exactly N×H times
22 Incorrect 44 ms 6632 KB function hops(h,c,d) must be called exactly N×H times
23 Incorrect 64 ms 7204 KB function hops(h,c,d) must be called exactly N×H times
# 결과 실행 시간 메모리 Grader output
1 Incorrect 197 ms 10396 KB function hops(h,c,d) must be called exactly N×H times
2 Runtime error 2 ms 464 KB Execution killed with signal 11
3 Incorrect 28 ms 5728 KB Output isn't correct
4 Runtime error 2 ms 464 KB Execution killed with signal 11
5 Incorrect 38 ms 5952 KB Output isn't correct
6 Incorrect 27 ms 5964 KB function hops(h,c,d) must be called exactly N×H times
7 Incorrect 39 ms 6540 KB function hops(h,c,d) must be called exactly N×H times
8 Incorrect 27 ms 5632 KB Output isn't correct
9 Incorrect 30 ms 5576 KB Output isn't correct
10 Incorrect 31 ms 5640 KB Output isn't correct
11 Incorrect 35 ms 5856 KB Output isn't correct
12 Correct 24 ms 5608 KB Output is partially correct - 80000 call(s) of encode_bit()
13 Incorrect 46 ms 6612 KB function hops(h,c,d) must be called exactly N×H times
14 Incorrect 27 ms 5668 KB Output isn't correct
15 Incorrect 26 ms 5852 KB Output isn't correct
16 Incorrect 46 ms 6292 KB Output isn't correct
17 Incorrect 38 ms 6124 KB Output isn't correct
18 Incorrect 49 ms 6500 KB function hops(h,c,d) must be called exactly N×H times
19 Incorrect 33 ms 6112 KB function hops(h,c,d) must be called exactly N×H times
20 Incorrect 55 ms 6724 KB function hops(h,c,d) must be called exactly N×H times
21 Incorrect 61 ms 7064 KB function hops(h,c,d) must be called exactly N×H times
22 Incorrect 44 ms 6632 KB function hops(h,c,d) must be called exactly N×H times
23 Incorrect 64 ms 7204 KB function hops(h,c,d) must be called exactly N×H times