Submission #565090

# Submission time Handle Problem Language Result Execution time Memory
565090 2022-05-20T08:56:20 Z birthdaycake Saveit (IOI10_saveit) C++17
0 / 100
272 ms 12804 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] = INT_MAX;
    }
}


void decode(int n, int h){
    
    reset(n,h);
    
    
    for(int i = 0; i < n; i++){
        for(int j = 0; j < h; j++){
            if(dis[j][i] != INT_MAX){
                dis[i][j] = dis[j][i];
                continue;
            }
            dis[i][j] = 0;
            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 Incorrect 272 ms 12804 KB Output isn't correct
2 Incorrect 2 ms 4604 KB Output isn't correct
3 Incorrect 78 ms 7584 KB Output isn't correct
4 Incorrect 2 ms 4604 KB Output isn't correct
5 Incorrect 71 ms 7724 KB Output isn't correct
6 Incorrect 74 ms 7988 KB Output isn't correct
7 Incorrect 98 ms 8376 KB Output isn't correct
8 Incorrect 71 ms 7776 KB Output isn't correct
9 Incorrect 75 ms 7832 KB Output isn't correct
10 Incorrect 75 ms 7824 KB Output isn't correct
11 Incorrect 103 ms 8036 KB Output isn't correct
12 Incorrect 75 ms 7800 KB Output isn't correct
13 Incorrect 98 ms 8524 KB Output isn't correct
14 Incorrect 89 ms 7804 KB Output isn't correct
15 Incorrect 72 ms 7904 KB Output isn't correct
16 Incorrect 108 ms 8364 KB Output isn't correct
17 Incorrect 102 ms 8304 KB Output isn't correct
18 Incorrect 97 ms 8648 KB Output isn't correct
19 Incorrect 82 ms 8192 KB Output isn't correct
20 Incorrect 122 ms 8932 KB Output isn't correct
21 Incorrect 111 ms 9020 KB Output isn't correct
22 Incorrect 115 ms 8592 KB Output isn't correct
23 Incorrect 127 ms 9276 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 272 ms 12804 KB Output isn't correct
2 Incorrect 2 ms 4604 KB Output isn't correct
3 Incorrect 78 ms 7584 KB Output isn't correct
4 Incorrect 2 ms 4604 KB Output isn't correct
5 Incorrect 71 ms 7724 KB Output isn't correct
6 Incorrect 74 ms 7988 KB Output isn't correct
7 Incorrect 98 ms 8376 KB Output isn't correct
8 Incorrect 71 ms 7776 KB Output isn't correct
9 Incorrect 75 ms 7832 KB Output isn't correct
10 Incorrect 75 ms 7824 KB Output isn't correct
11 Incorrect 103 ms 8036 KB Output isn't correct
12 Incorrect 75 ms 7800 KB Output isn't correct
13 Incorrect 98 ms 8524 KB Output isn't correct
14 Incorrect 89 ms 7804 KB Output isn't correct
15 Incorrect 72 ms 7904 KB Output isn't correct
16 Incorrect 108 ms 8364 KB Output isn't correct
17 Incorrect 102 ms 8304 KB Output isn't correct
18 Incorrect 97 ms 8648 KB Output isn't correct
19 Incorrect 82 ms 8192 KB Output isn't correct
20 Incorrect 122 ms 8932 KB Output isn't correct
21 Incorrect 111 ms 9020 KB Output isn't correct
22 Incorrect 115 ms 8592 KB Output isn't correct
23 Incorrect 127 ms 9276 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 272 ms 12804 KB Output isn't correct
2 Incorrect 2 ms 4604 KB Output isn't correct
3 Incorrect 78 ms 7584 KB Output isn't correct
4 Incorrect 2 ms 4604 KB Output isn't correct
5 Incorrect 71 ms 7724 KB Output isn't correct
6 Incorrect 74 ms 7988 KB Output isn't correct
7 Incorrect 98 ms 8376 KB Output isn't correct
8 Incorrect 71 ms 7776 KB Output isn't correct
9 Incorrect 75 ms 7832 KB Output isn't correct
10 Incorrect 75 ms 7824 KB Output isn't correct
11 Incorrect 103 ms 8036 KB Output isn't correct
12 Incorrect 75 ms 7800 KB Output isn't correct
13 Incorrect 98 ms 8524 KB Output isn't correct
14 Incorrect 89 ms 7804 KB Output isn't correct
15 Incorrect 72 ms 7904 KB Output isn't correct
16 Incorrect 108 ms 8364 KB Output isn't correct
17 Incorrect 102 ms 8304 KB Output isn't correct
18 Incorrect 97 ms 8648 KB Output isn't correct
19 Incorrect 82 ms 8192 KB Output isn't correct
20 Incorrect 122 ms 8932 KB Output isn't correct
21 Incorrect 111 ms 9020 KB Output isn't correct
22 Incorrect 115 ms 8592 KB Output isn't correct
23 Incorrect 127 ms 9276 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 272 ms 12804 KB Output isn't correct
2 Incorrect 2 ms 4604 KB Output isn't correct
3 Incorrect 78 ms 7584 KB Output isn't correct
4 Incorrect 2 ms 4604 KB Output isn't correct
5 Incorrect 71 ms 7724 KB Output isn't correct
6 Incorrect 74 ms 7988 KB Output isn't correct
7 Incorrect 98 ms 8376 KB Output isn't correct
8 Incorrect 71 ms 7776 KB Output isn't correct
9 Incorrect 75 ms 7832 KB Output isn't correct
10 Incorrect 75 ms 7824 KB Output isn't correct
11 Incorrect 103 ms 8036 KB Output isn't correct
12 Incorrect 75 ms 7800 KB Output isn't correct
13 Incorrect 98 ms 8524 KB Output isn't correct
14 Incorrect 89 ms 7804 KB Output isn't correct
15 Incorrect 72 ms 7904 KB Output isn't correct
16 Incorrect 108 ms 8364 KB Output isn't correct
17 Incorrect 102 ms 8304 KB Output isn't correct
18 Incorrect 97 ms 8648 KB Output isn't correct
19 Incorrect 82 ms 8192 KB Output isn't correct
20 Incorrect 122 ms 8932 KB Output isn't correct
21 Incorrect 111 ms 9020 KB Output isn't correct
22 Incorrect 115 ms 8592 KB Output isn't correct
23 Incorrect 127 ms 9276 KB Output isn't correct