Submission #565009

# Submission time Handle Problem Language Result Execution time Memory
565009 2022-05-20T07:42:37 Z birthdaycake Saveit (IOI10_saveit) C++17
50 / 100
272 ms 12680 KB
#include<bits/stdc++.h>
#include "grader.h"
#include "encoder.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>
#include "grader.h"
#include "decoder.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;
    }
}


void 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++){
                if(decode_bit()){
                    dis[i][j] += (1 << k);
                }
               
            }
        }
    }
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < h; j++){
            hops(j,i,dis[i][j]);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 272 ms 12680 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 3 ms 4600 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 83 ms 7604 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 4 ms 4604 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 95 ms 7708 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 95 ms 7912 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 99 ms 8356 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 70 ms 7708 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 79 ms 7844 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 90 ms 7808 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 82 ms 7956 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 75 ms 7804 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 115 ms 8440 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 77 ms 7932 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 77 ms 7832 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 123 ms 8280 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 101 ms 8340 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 102 ms 8664 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 102 ms 8216 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 121 ms 8896 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 127 ms 9052 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 92 ms 8464 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 125 ms 9252 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 272 ms 12680 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 3 ms 4600 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 83 ms 7604 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 4 ms 4604 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 95 ms 7708 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 95 ms 7912 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 99 ms 8356 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 70 ms 7708 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 79 ms 7844 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 90 ms 7808 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 82 ms 7956 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 75 ms 7804 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 115 ms 8440 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 77 ms 7932 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 77 ms 7832 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 123 ms 8280 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 101 ms 8340 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 102 ms 8664 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 102 ms 8216 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 121 ms 8896 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 127 ms 9052 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 92 ms 8464 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 125 ms 9252 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 272 ms 12680 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 3 ms 4600 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 83 ms 7604 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 4 ms 4604 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 95 ms 7708 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 95 ms 7912 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 99 ms 8356 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 70 ms 7708 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 79 ms 7844 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 90 ms 7808 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 82 ms 7956 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 75 ms 7804 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 115 ms 8440 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 77 ms 7932 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 77 ms 7832 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 123 ms 8280 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 101 ms 8340 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 102 ms 8664 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 102 ms 8216 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 121 ms 8896 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 127 ms 9052 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 92 ms 8464 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 125 ms 9252 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 272 ms 12680 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 3 ms 4600 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 83 ms 7604 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 4 ms 4604 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 95 ms 7708 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 95 ms 7912 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 99 ms 8356 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 70 ms 7708 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 79 ms 7844 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 90 ms 7808 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 82 ms 7956 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 75 ms 7804 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 115 ms 8440 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 77 ms 7932 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 77 ms 7832 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 123 ms 8280 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 101 ms 8340 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 102 ms 8664 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 102 ms 8216 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 121 ms 8896 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 127 ms 9052 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 92 ms 8464 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 125 ms 9252 KB Output is partially correct - 360000 call(s) of encode_bit()