Submission #573249

# Submission time Handle Problem Language Result Execution time Memory
573249 2022-06-06T09:53:57 Z Vanilla Saveit (IOI10_saveit) C++17
50 / 100
250 ms 12584 KB
#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
const int maxn = 1002;
vector <int> ad [maxn];
int dist [36][maxn];

void bfs (int x) {
  queue <int> q;
  q.push(x);
  dist[x][x] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int v: ad[u]) {
      if (dist[x][u] + 1 < dist[x][v]) {
        dist[x][v] = dist[x][u] + 1;
        q.push(v);
      }
    }
  }
}

void encode(int N, int H, int P, int *v1, int *v2){
  for (int i = 0; i < P; i++){
    ad[v1[i]].push_back(v2[i]);
    ad[v2[i]].push_back(v1[i]);
  }
  for (int i = 0; i < H; i++){
    for (int j = 0; j < maxn; j++){
      dist[i][j] = 1000;
    }
  }
  
  for (int i = 0; i < H; i++){
    bfs(i);
  }
  for (int i = 0; i < H; i++){
    for (int k = 0; k < N; k++){
      for (int j = 0; j < 10; j++){
        encode_bit(!!(dist[i][k] & (1 << j)));
      }
    }
  }
  return;
}
#include "grader.h"
#include "decoder.h"

void decode(int N, int H) {
   for (int i = 0; i < H; i++){
      for (int j = 0; j < N; j++){
         int val = 0;
         for (int k = 0; k < 10; k++){
            val+=(1 << k) * decode_bit();
         }
         hops(i,j,val);
      }
   }
}
# Verdict Execution time Memory Grader output
1 Correct 250 ms 12584 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 1 ms 4604 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 57 ms 7468 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 3 ms 4600 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 67 ms 7628 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 89 ms 7896 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 91 ms 8132 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 63 ms 7572 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 66 ms 7752 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 114 ms 7676 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 83 ms 7836 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 70 ms 7704 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 112 ms 8360 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 67 ms 7708 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 69 ms 7772 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 84 ms 8220 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 97 ms 8084 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 93 ms 8344 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 90 ms 8096 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 107 ms 8740 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 112 ms 8928 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 121 ms 8384 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 113 ms 9048 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 250 ms 12584 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 1 ms 4604 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 57 ms 7468 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 3 ms 4600 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 67 ms 7628 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 89 ms 7896 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 91 ms 8132 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 63 ms 7572 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 66 ms 7752 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 114 ms 7676 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 83 ms 7836 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 70 ms 7704 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 112 ms 8360 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 67 ms 7708 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 69 ms 7772 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 84 ms 8220 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 97 ms 8084 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 93 ms 8344 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 90 ms 8096 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 107 ms 8740 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 112 ms 8928 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 121 ms 8384 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 113 ms 9048 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 250 ms 12584 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 1 ms 4604 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 57 ms 7468 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 3 ms 4600 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 67 ms 7628 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 89 ms 7896 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 91 ms 8132 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 63 ms 7572 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 66 ms 7752 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 114 ms 7676 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 83 ms 7836 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 70 ms 7704 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 112 ms 8360 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 67 ms 7708 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 69 ms 7772 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 84 ms 8220 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 97 ms 8084 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 93 ms 8344 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 90 ms 8096 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 107 ms 8740 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 112 ms 8928 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 121 ms 8384 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 113 ms 9048 KB Output is partially correct - 360000 call(s) of encode_bit()
# Verdict Execution time Memory Grader output
1 Correct 250 ms 12584 KB Output is partially correct - 360000 call(s) of encode_bit()
2 Correct 1 ms 4604 KB Output is correct - 150 call(s) of encode_bit()
3 Correct 57 ms 7468 KB Output is partially correct - 324000 call(s) of encode_bit()
4 Correct 3 ms 4600 KB Output is correct - 250 call(s) of encode_bit()
5 Correct 67 ms 7628 KB Output is partially correct - 324000 call(s) of encode_bit()
6 Correct 89 ms 7896 KB Output is partially correct - 360000 call(s) of encode_bit()
7 Correct 91 ms 8132 KB Output is partially correct - 360000 call(s) of encode_bit()
8 Correct 63 ms 7572 KB Output is partially correct - 345960 call(s) of encode_bit()
9 Correct 66 ms 7752 KB Output is partially correct - 360000 call(s) of encode_bit()
10 Correct 114 ms 7676 KB Output is partially correct - 360000 call(s) of encode_bit()
11 Correct 83 ms 7836 KB Output is partially correct - 360000 call(s) of encode_bit()
12 Correct 70 ms 7704 KB Output is partially correct - 360000 call(s) of encode_bit()
13 Correct 112 ms 8360 KB Output is partially correct - 360000 call(s) of encode_bit()
14 Correct 67 ms 7708 KB Output is partially correct - 360000 call(s) of encode_bit()
15 Correct 69 ms 7772 KB Output is partially correct - 360000 call(s) of encode_bit()
16 Correct 84 ms 8220 KB Output is partially correct - 360000 call(s) of encode_bit()
17 Correct 97 ms 8084 KB Output is partially correct - 360000 call(s) of encode_bit()
18 Correct 93 ms 8344 KB Output is partially correct - 360000 call(s) of encode_bit()
19 Correct 90 ms 8096 KB Output is partially correct - 360000 call(s) of encode_bit()
20 Correct 107 ms 8740 KB Output is partially correct - 360000 call(s) of encode_bit()
21 Correct 112 ms 8928 KB Output is partially correct - 360000 call(s) of encode_bit()
22 Correct 121 ms 8384 KB Output is partially correct - 360000 call(s) of encode_bit()
23 Correct 113 ms 9048 KB Output is partially correct - 360000 call(s) of encode_bit()