Submission #565166

# Submission time Handle Problem Language Result Execution time Memory
565166 2022-05-20T11:14:48 Z MrDeboo Saveit (IOI10_saveit) C++17
0 / 100
223 ms 11420 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[]){
    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<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();
            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({-p.first,{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=100000/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<100000/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;}}
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 223 ms 11420 KB function hops(h,c,d) must be called exactly N×H times
2 Correct 17 ms 5516 KB Output is partially correct - 100000 call(s) of encode_bit()
3 Correct 37 ms 5936 KB Output is partially correct - 100000 call(s) of encode_bit()
4 Correct 20 ms 5484 KB Output is partially correct - 100000 call(s) of encode_bit()
5 Incorrect 38 ms 6536 KB function hops(h,c,d) must be called exactly N×H times
6 Incorrect 35 ms 6432 KB function hops(h,c,d) must be called exactly N×H times
7 Incorrect 49 ms 7396 KB function hops(h,c,d) must be called exactly N×H times
8 Correct 35 ms 5752 KB Output is partially correct - 100000 call(s) of encode_bit()
9 Correct 36 ms 5912 KB Output is partially correct - 100000 call(s) of encode_bit()
10 Correct 33 ms 5792 KB Output is partially correct - 100000 call(s) of encode_bit()
11 Correct 35 ms 6204 KB Output is partially correct - 100000 call(s) of encode_bit()
12 Correct 30 ms 5760 KB Output is partially correct - 100000 call(s) of encode_bit()
13 Incorrect 64 ms 7120 KB function hops(h,c,d) must be called exactly N×H times
14 Correct 30 ms 5864 KB Output is partially correct - 100000 call(s) of encode_bit()
15 Correct 35 ms 6016 KB Output is partially correct - 100000 call(s) of encode_bit()
16 Incorrect 53 ms 6532 KB function hops(h,c,d) must be called exactly N×H times
17 Correct 59 ms 6360 KB Output is partially correct - 100000 call(s) of encode_bit()
18 Incorrect 60 ms 6992 KB function hops(h,c,d) must be called exactly N×H times
19 Incorrect 43 ms 6716 KB function hops(h,c,d) must be called exactly N×H times
20 Incorrect 65 ms 7372 KB function hops(h,c,d) must be called exactly N×H times
21 Incorrect 71 ms 7528 KB function hops(h,c,d) must be called exactly N×H times
22 Incorrect 57 ms 7556 KB function hops(h,c,d) must be called exactly N×H times
23 Incorrect 76 ms 8088 KB function hops(h,c,d) must be called exactly N×H times
# Verdict Execution time Memory Grader output
1 Incorrect 223 ms 11420 KB function hops(h,c,d) must be called exactly N×H times
2 Correct 17 ms 5516 KB Output is partially correct - 100000 call(s) of encode_bit()
3 Correct 37 ms 5936 KB Output is partially correct - 100000 call(s) of encode_bit()
4 Correct 20 ms 5484 KB Output is partially correct - 100000 call(s) of encode_bit()
5 Incorrect 38 ms 6536 KB function hops(h,c,d) must be called exactly N×H times
6 Incorrect 35 ms 6432 KB function hops(h,c,d) must be called exactly N×H times
7 Incorrect 49 ms 7396 KB function hops(h,c,d) must be called exactly N×H times
8 Correct 35 ms 5752 KB Output is partially correct - 100000 call(s) of encode_bit()
9 Correct 36 ms 5912 KB Output is partially correct - 100000 call(s) of encode_bit()
10 Correct 33 ms 5792 KB Output is partially correct - 100000 call(s) of encode_bit()
11 Correct 35 ms 6204 KB Output is partially correct - 100000 call(s) of encode_bit()
12 Correct 30 ms 5760 KB Output is partially correct - 100000 call(s) of encode_bit()
13 Incorrect 64 ms 7120 KB function hops(h,c,d) must be called exactly N×H times
14 Correct 30 ms 5864 KB Output is partially correct - 100000 call(s) of encode_bit()
15 Correct 35 ms 6016 KB Output is partially correct - 100000 call(s) of encode_bit()
16 Incorrect 53 ms 6532 KB function hops(h,c,d) must be called exactly N×H times
17 Correct 59 ms 6360 KB Output is partially correct - 100000 call(s) of encode_bit()
18 Incorrect 60 ms 6992 KB function hops(h,c,d) must be called exactly N×H times
19 Incorrect 43 ms 6716 KB function hops(h,c,d) must be called exactly N×H times
20 Incorrect 65 ms 7372 KB function hops(h,c,d) must be called exactly N×H times
21 Incorrect 71 ms 7528 KB function hops(h,c,d) must be called exactly N×H times
22 Incorrect 57 ms 7556 KB function hops(h,c,d) must be called exactly N×H times
23 Incorrect 76 ms 8088 KB function hops(h,c,d) must be called exactly N×H times
# Verdict Execution time Memory Grader output
1 Incorrect 223 ms 11420 KB function hops(h,c,d) must be called exactly N×H times
2 Correct 17 ms 5516 KB Output is partially correct - 100000 call(s) of encode_bit()
3 Correct 37 ms 5936 KB Output is partially correct - 100000 call(s) of encode_bit()
4 Correct 20 ms 5484 KB Output is partially correct - 100000 call(s) of encode_bit()
5 Incorrect 38 ms 6536 KB function hops(h,c,d) must be called exactly N×H times
6 Incorrect 35 ms 6432 KB function hops(h,c,d) must be called exactly N×H times
7 Incorrect 49 ms 7396 KB function hops(h,c,d) must be called exactly N×H times
8 Correct 35 ms 5752 KB Output is partially correct - 100000 call(s) of encode_bit()
9 Correct 36 ms 5912 KB Output is partially correct - 100000 call(s) of encode_bit()
10 Correct 33 ms 5792 KB Output is partially correct - 100000 call(s) of encode_bit()
11 Correct 35 ms 6204 KB Output is partially correct - 100000 call(s) of encode_bit()
12 Correct 30 ms 5760 KB Output is partially correct - 100000 call(s) of encode_bit()
13 Incorrect 64 ms 7120 KB function hops(h,c,d) must be called exactly N×H times
14 Correct 30 ms 5864 KB Output is partially correct - 100000 call(s) of encode_bit()
15 Correct 35 ms 6016 KB Output is partially correct - 100000 call(s) of encode_bit()
16 Incorrect 53 ms 6532 KB function hops(h,c,d) must be called exactly N×H times
17 Correct 59 ms 6360 KB Output is partially correct - 100000 call(s) of encode_bit()
18 Incorrect 60 ms 6992 KB function hops(h,c,d) must be called exactly N×H times
19 Incorrect 43 ms 6716 KB function hops(h,c,d) must be called exactly N×H times
20 Incorrect 65 ms 7372 KB function hops(h,c,d) must be called exactly N×H times
21 Incorrect 71 ms 7528 KB function hops(h,c,d) must be called exactly N×H times
22 Incorrect 57 ms 7556 KB function hops(h,c,d) must be called exactly N×H times
23 Incorrect 76 ms 8088 KB function hops(h,c,d) must be called exactly N×H times
# Verdict Execution time Memory Grader output
1 Incorrect 223 ms 11420 KB function hops(h,c,d) must be called exactly N×H times
2 Correct 17 ms 5516 KB Output is partially correct - 100000 call(s) of encode_bit()
3 Correct 37 ms 5936 KB Output is partially correct - 100000 call(s) of encode_bit()
4 Correct 20 ms 5484 KB Output is partially correct - 100000 call(s) of encode_bit()
5 Incorrect 38 ms 6536 KB function hops(h,c,d) must be called exactly N×H times
6 Incorrect 35 ms 6432 KB function hops(h,c,d) must be called exactly N×H times
7 Incorrect 49 ms 7396 KB function hops(h,c,d) must be called exactly N×H times
8 Correct 35 ms 5752 KB Output is partially correct - 100000 call(s) of encode_bit()
9 Correct 36 ms 5912 KB Output is partially correct - 100000 call(s) of encode_bit()
10 Correct 33 ms 5792 KB Output is partially correct - 100000 call(s) of encode_bit()
11 Correct 35 ms 6204 KB Output is partially correct - 100000 call(s) of encode_bit()
12 Correct 30 ms 5760 KB Output is partially correct - 100000 call(s) of encode_bit()
13 Incorrect 64 ms 7120 KB function hops(h,c,d) must be called exactly N×H times
14 Correct 30 ms 5864 KB Output is partially correct - 100000 call(s) of encode_bit()
15 Correct 35 ms 6016 KB Output is partially correct - 100000 call(s) of encode_bit()
16 Incorrect 53 ms 6532 KB function hops(h,c,d) must be called exactly N×H times
17 Correct 59 ms 6360 KB Output is partially correct - 100000 call(s) of encode_bit()
18 Incorrect 60 ms 6992 KB function hops(h,c,d) must be called exactly N×H times
19 Incorrect 43 ms 6716 KB function hops(h,c,d) must be called exactly N×H times
20 Incorrect 65 ms 7372 KB function hops(h,c,d) must be called exactly N×H times
21 Incorrect 71 ms 7528 KB function hops(h,c,d) must be called exactly N×H times
22 Incorrect 57 ms 7556 KB function hops(h,c,d) must be called exactly N×H times
23 Incorrect 76 ms 8088 KB function hops(h,c,d) must be called exactly N×H times