Submission #792131

# Submission time Handle Problem Language Result Execution time Memory
792131 2023-07-24T15:41:36 Z irmuun Saveit (IOI10_saveit) C++17
25 / 100
256 ms 12732 KB
#include<bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
 
using namespace std;
 
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
 
void encode(int N,int H,int P,int *A,int *B){
    vector<int>adj[N];
    for(int i=0;i<P;i++){
        adj[A[i]].pb(B[i]);
        adj[B[i]].pb(A[i]);
    }
    pair<int,int>d[N];
    for(int i=0;i<H;i++){
        for(int j=0;j<N;j++){
            d[j]={-1,j};
        }
        queue<int>q;
        d[i].ff=0;
        q.push(i);
        while(!q.empty()){
            int x=q.front();
            q.pop();
            for(auto y:adj[x]){
                if(d[y].ff==-1){
                    d[y].ff=d[x].ff+1;
                    q.push(y);
                }
            }
        }
        sort(d,d+N);
        for(int j=1;j<N;j++){
            if(d[j].ff==d[j-1].ff){
                encode_bit(0);
            }
            else{
                encode_bit(1);
            }
            for(int k=0;k<10;k++){
                encode_bit(d[j].ss%2);
                d[j].ss/=2;
            }
        }
    }
}
#include<bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
 
using namespace std;
 
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
 
void decode(int N,int H){
    for(int i=0;i<H;i++){
        hops(i,i,0);
        int dist=0;
        for(int j=1;j<N;j++){
            int city=0;
            dist+=decode_bit();
            for(int k=0;k<10;k++){
                city+=decode_bit()*(1<<k);
            }
            hops(i,city,dist);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 256 ms 12732 KB Output is partially correct - 395604 call(s) of encode_bit()
2 Correct 1 ms 4604 KB Output is correct - 132 call(s) of encode_bit()
3 Correct 59 ms 7500 KB Output is partially correct - 356004 call(s) of encode_bit()
4 Correct 2 ms 4612 KB Output is correct - 220 call(s) of encode_bit()
5 Correct 62 ms 7696 KB Output is partially correct - 356004 call(s) of encode_bit()
6 Correct 67 ms 8020 KB Output is partially correct - 395604 call(s) of encode_bit()
7 Correct 81 ms 8256 KB Output is partially correct - 395604 call(s) of encode_bit()
8 Correct 73 ms 7704 KB Output is partially correct - 380160 call(s) of encode_bit()
9 Correct 68 ms 7792 KB Output is partially correct - 395604 call(s) of encode_bit()
10 Correct 70 ms 7792 KB Output is partially correct - 395604 call(s) of encode_bit()
11 Correct 68 ms 7948 KB Output is partially correct - 395604 call(s) of encode_bit()
12 Correct 65 ms 7880 KB Output is partially correct - 395604 call(s) of encode_bit()
13 Correct 95 ms 8508 KB Output is partially correct - 395604 call(s) of encode_bit()
14 Correct 68 ms 7912 KB Output is partially correct - 395604 call(s) of encode_bit()
15 Correct 65 ms 7852 KB Output is partially correct - 395604 call(s) of encode_bit()
16 Correct 90 ms 8376 KB Output is partially correct - 395604 call(s) of encode_bit()
17 Correct 83 ms 8276 KB Output is partially correct - 395604 call(s) of encode_bit()
18 Correct 89 ms 8604 KB Output is partially correct - 395604 call(s) of encode_bit()
19 Correct 74 ms 8272 KB Output is partially correct - 395604 call(s) of encode_bit()
20 Correct 94 ms 8852 KB Output is partially correct - 395604 call(s) of encode_bit()
21 Correct 113 ms 8996 KB Output is partially correct - 395604 call(s) of encode_bit()
22 Correct 90 ms 8504 KB Output is partially correct - 395604 call(s) of encode_bit()
23 Correct 122 ms 9232 KB Output is partially correct - 395604 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 256 ms 12732 KB Output is partially correct - 395604 call(s) of encode_bit()
2 Correct 1 ms 4604 KB Output is correct - 132 call(s) of encode_bit()
3 Correct 59 ms 7500 KB Output is partially correct - 356004 call(s) of encode_bit()
4 Correct 2 ms 4612 KB Output is correct - 220 call(s) of encode_bit()
5 Correct 62 ms 7696 KB Output is partially correct - 356004 call(s) of encode_bit()
6 Correct 67 ms 8020 KB Output is partially correct - 395604 call(s) of encode_bit()
7 Correct 81 ms 8256 KB Output is partially correct - 395604 call(s) of encode_bit()
8 Correct 73 ms 7704 KB Output is partially correct - 380160 call(s) of encode_bit()
9 Correct 68 ms 7792 KB Output is partially correct - 395604 call(s) of encode_bit()
10 Correct 70 ms 7792 KB Output is partially correct - 395604 call(s) of encode_bit()
11 Correct 68 ms 7948 KB Output is partially correct - 395604 call(s) of encode_bit()
12 Correct 65 ms 7880 KB Output is partially correct - 395604 call(s) of encode_bit()
13 Correct 95 ms 8508 KB Output is partially correct - 395604 call(s) of encode_bit()
14 Correct 68 ms 7912 KB Output is partially correct - 395604 call(s) of encode_bit()
15 Correct 65 ms 7852 KB Output is partially correct - 395604 call(s) of encode_bit()
16 Correct 90 ms 8376 KB Output is partially correct - 395604 call(s) of encode_bit()
17 Correct 83 ms 8276 KB Output is partially correct - 395604 call(s) of encode_bit()
18 Correct 89 ms 8604 KB Output is partially correct - 395604 call(s) of encode_bit()
19 Correct 74 ms 8272 KB Output is partially correct - 395604 call(s) of encode_bit()
20 Correct 94 ms 8852 KB Output is partially correct - 395604 call(s) of encode_bit()
21 Correct 113 ms 8996 KB Output is partially correct - 395604 call(s) of encode_bit()
22 Correct 90 ms 8504 KB Output is partially correct - 395604 call(s) of encode_bit()
23 Correct 122 ms 9232 KB Output is partially correct - 395604 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 256 ms 12732 KB Output is partially correct - 395604 call(s) of encode_bit()
2 Correct 1 ms 4604 KB Output is correct - 132 call(s) of encode_bit()
3 Correct 59 ms 7500 KB Output is partially correct - 356004 call(s) of encode_bit()
4 Correct 2 ms 4612 KB Output is correct - 220 call(s) of encode_bit()
5 Correct 62 ms 7696 KB Output is partially correct - 356004 call(s) of encode_bit()
6 Correct 67 ms 8020 KB Output is partially correct - 395604 call(s) of encode_bit()
7 Correct 81 ms 8256 KB Output is partially correct - 395604 call(s) of encode_bit()
8 Correct 73 ms 7704 KB Output is partially correct - 380160 call(s) of encode_bit()
9 Correct 68 ms 7792 KB Output is partially correct - 395604 call(s) of encode_bit()
10 Correct 70 ms 7792 KB Output is partially correct - 395604 call(s) of encode_bit()
11 Correct 68 ms 7948 KB Output is partially correct - 395604 call(s) of encode_bit()
12 Correct 65 ms 7880 KB Output is partially correct - 395604 call(s) of encode_bit()
13 Correct 95 ms 8508 KB Output is partially correct - 395604 call(s) of encode_bit()
14 Correct 68 ms 7912 KB Output is partially correct - 395604 call(s) of encode_bit()
15 Correct 65 ms 7852 KB Output is partially correct - 395604 call(s) of encode_bit()
16 Correct 90 ms 8376 KB Output is partially correct - 395604 call(s) of encode_bit()
17 Correct 83 ms 8276 KB Output is partially correct - 395604 call(s) of encode_bit()
18 Correct 89 ms 8604 KB Output is partially correct - 395604 call(s) of encode_bit()
19 Correct 74 ms 8272 KB Output is partially correct - 395604 call(s) of encode_bit()
20 Correct 94 ms 8852 KB Output is partially correct - 395604 call(s) of encode_bit()
21 Correct 113 ms 8996 KB Output is partially correct - 395604 call(s) of encode_bit()
22 Correct 90 ms 8504 KB Output is partially correct - 395604 call(s) of encode_bit()
23 Correct 122 ms 9232 KB Output is partially correct - 395604 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 256 ms 12732 KB Output is partially correct - 395604 call(s) of encode_bit()
2 Correct 1 ms 4604 KB Output is correct - 132 call(s) of encode_bit()
3 Correct 59 ms 7500 KB Output is partially correct - 356004 call(s) of encode_bit()
4 Correct 2 ms 4612 KB Output is correct - 220 call(s) of encode_bit()
5 Correct 62 ms 7696 KB Output is partially correct - 356004 call(s) of encode_bit()
6 Correct 67 ms 8020 KB Output is partially correct - 395604 call(s) of encode_bit()
7 Correct 81 ms 8256 KB Output is partially correct - 395604 call(s) of encode_bit()
8 Correct 73 ms 7704 KB Output is partially correct - 380160 call(s) of encode_bit()
9 Correct 68 ms 7792 KB Output is partially correct - 395604 call(s) of encode_bit()
10 Correct 70 ms 7792 KB Output is partially correct - 395604 call(s) of encode_bit()
11 Correct 68 ms 7948 KB Output is partially correct - 395604 call(s) of encode_bit()
12 Correct 65 ms 7880 KB Output is partially correct - 395604 call(s) of encode_bit()
13 Correct 95 ms 8508 KB Output is partially correct - 395604 call(s) of encode_bit()
14 Correct 68 ms 7912 KB Output is partially correct - 395604 call(s) of encode_bit()
15 Correct 65 ms 7852 KB Output is partially correct - 395604 call(s) of encode_bit()
16 Correct 90 ms 8376 KB Output is partially correct - 395604 call(s) of encode_bit()
17 Correct 83 ms 8276 KB Output is partially correct - 395604 call(s) of encode_bit()
18 Correct 89 ms 8604 KB Output is partially correct - 395604 call(s) of encode_bit()
19 Correct 74 ms 8272 KB Output is partially correct - 395604 call(s) of encode_bit()
20 Correct 94 ms 8852 KB Output is partially correct - 395604 call(s) of encode_bit()
21 Correct 113 ms 8996 KB Output is partially correct - 395604 call(s) of encode_bit()
22 Correct 90 ms 8504 KB Output is partially correct - 395604 call(s) of encode_bit()
23 Correct 122 ms 9232 KB Output is partially correct - 395604 call(s) of encode_bit()