답안 #565027

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
565027 2022-05-20T07:55:58 Z RealSnake 저장 (Saveit) (IOI10_saveit) C++14
50 / 100
652 ms 12280 KB
#include "bits/stdc++.h"
using namespace std;
#include "grader.h"
#include "encoder.h"

void encode(int n, int h, int p, int a[], int b[]) {
    vector<int> v[n];
    for(int i = 0; i < p; i++) {
        v[a[i]].push_back(b[i]);
        v[b[i]].push_back(a[i]);
    }
    bool vis[n];
    int dd[n];
    for(int i = n - 1; i >= 0; i--) {
        for(int j = 0; j < n; j++) {
            vis[j] = 0;
            dd[j] = 1e9;
        }
        set<pair<int, int>> s;
        s.insert({0, i});
        dd[i] = 0;
        while(s.size()) {
            pair<int, int> p = *s.begin();
            s.erase(s.begin());
            int x = p.second;
            int d = p.first;
            if(vis[x])
                continue;
            vis[x] = 1;
            for(int j : v[x]) {
                if(d + 1 < dd[j]) {
                    dd[j] = d + 1;
                    vis[x] = 0;
                    s.insert({d + 1, j});
                }
            }
        }
        for(int j = min(h - 1, i); j >= 0; j--) {
            for(int bit = 0; bit < 10; bit++)
                encode_bit((dd[j] & (1 << bit)) > 0);
        }
    }
    return;
}
#include "bits/stdc++.h"
using namespace std;
#include "grader.h"
#include "encoder.h"

void decode(int n, int h) {
    for(int i = n - 1; i >= 0; i--) {
        for(int j = min(h - 1, i); j >= 0; j--) {
            int d = 0;
            for(int bit = 0; bit < 10; bit++) {
                if(decode_bit())
                    d += (1 << bit);
            }
            hops(j, i, d);
            if(i < h && i != j)
                hops(i, j, d);
        }
    }
    return;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 652 ms 12280 KB Output is partially correct - 353700 call(s) of encode_bit()
2 Correct 2 ms 4604 KB Output is correct - 120 call(s) of encode_bit()
3 Correct 206 ms 7328 KB Output is partially correct - 317700 call(s) of encode_bit()
4 Correct 2 ms 4608 KB Output is correct - 150 call(s) of encode_bit()
5 Correct 206 ms 7456 KB Output is partially correct - 317700 call(s) of encode_bit()
6 Correct 242 ms 7748 KB Output is partially correct - 353700 call(s) of encode_bit()
7 Correct 283 ms 8052 KB Output is partially correct - 353700 call(s) of encode_bit()
8 Correct 207 ms 7400 KB Output is partially correct - 339660 call(s) of encode_bit()
9 Correct 179 ms 7572 KB Output is partially correct - 353700 call(s) of encode_bit()
10 Correct 190 ms 7452 KB Output is partially correct - 353700 call(s) of encode_bit()
11 Correct 230 ms 7716 KB Output is partially correct - 353700 call(s) of encode_bit()
12 Correct 117 ms 7440 KB Output is partially correct - 353700 call(s) of encode_bit()
13 Correct 304 ms 8200 KB Output is partially correct - 353700 call(s) of encode_bit()
14 Correct 162 ms 7548 KB Output is partially correct - 353700 call(s) of encode_bit()
15 Correct 163 ms 7568 KB Output is partially correct - 353700 call(s) of encode_bit()
16 Correct 236 ms 8000 KB Output is partially correct - 353700 call(s) of encode_bit()
17 Correct 231 ms 8116 KB Output is partially correct - 353700 call(s) of encode_bit()
18 Correct 282 ms 8460 KB Output is partially correct - 353700 call(s) of encode_bit()
19 Correct 251 ms 7808 KB Output is partially correct - 353700 call(s) of encode_bit()
20 Correct 312 ms 8584 KB Output is partially correct - 353700 call(s) of encode_bit()
21 Correct 343 ms 8788 KB Output is partially correct - 353700 call(s) of encode_bit()
22 Correct 293 ms 8216 KB Output is partially correct - 353700 call(s) of encode_bit()
23 Correct 361 ms 8956 KB Output is partially correct - 353700 call(s) of encode_bit()
# 결과 실행 시간 메모리 Grader output
1 Correct 652 ms 12280 KB Output is partially correct - 353700 call(s) of encode_bit()
2 Correct 2 ms 4604 KB Output is correct - 120 call(s) of encode_bit()
3 Correct 206 ms 7328 KB Output is partially correct - 317700 call(s) of encode_bit()
4 Correct 2 ms 4608 KB Output is correct - 150 call(s) of encode_bit()
5 Correct 206 ms 7456 KB Output is partially correct - 317700 call(s) of encode_bit()
6 Correct 242 ms 7748 KB Output is partially correct - 353700 call(s) of encode_bit()
7 Correct 283 ms 8052 KB Output is partially correct - 353700 call(s) of encode_bit()
8 Correct 207 ms 7400 KB Output is partially correct - 339660 call(s) of encode_bit()
9 Correct 179 ms 7572 KB Output is partially correct - 353700 call(s) of encode_bit()
10 Correct 190 ms 7452 KB Output is partially correct - 353700 call(s) of encode_bit()
11 Correct 230 ms 7716 KB Output is partially correct - 353700 call(s) of encode_bit()
12 Correct 117 ms 7440 KB Output is partially correct - 353700 call(s) of encode_bit()
13 Correct 304 ms 8200 KB Output is partially correct - 353700 call(s) of encode_bit()
14 Correct 162 ms 7548 KB Output is partially correct - 353700 call(s) of encode_bit()
15 Correct 163 ms 7568 KB Output is partially correct - 353700 call(s) of encode_bit()
16 Correct 236 ms 8000 KB Output is partially correct - 353700 call(s) of encode_bit()
17 Correct 231 ms 8116 KB Output is partially correct - 353700 call(s) of encode_bit()
18 Correct 282 ms 8460 KB Output is partially correct - 353700 call(s) of encode_bit()
19 Correct 251 ms 7808 KB Output is partially correct - 353700 call(s) of encode_bit()
20 Correct 312 ms 8584 KB Output is partially correct - 353700 call(s) of encode_bit()
21 Correct 343 ms 8788 KB Output is partially correct - 353700 call(s) of encode_bit()
22 Correct 293 ms 8216 KB Output is partially correct - 353700 call(s) of encode_bit()
23 Correct 361 ms 8956 KB Output is partially correct - 353700 call(s) of encode_bit()
# 결과 실행 시간 메모리 Grader output
1 Correct 652 ms 12280 KB Output is partially correct - 353700 call(s) of encode_bit()
2 Correct 2 ms 4604 KB Output is correct - 120 call(s) of encode_bit()
3 Correct 206 ms 7328 KB Output is partially correct - 317700 call(s) of encode_bit()
4 Correct 2 ms 4608 KB Output is correct - 150 call(s) of encode_bit()
5 Correct 206 ms 7456 KB Output is partially correct - 317700 call(s) of encode_bit()
6 Correct 242 ms 7748 KB Output is partially correct - 353700 call(s) of encode_bit()
7 Correct 283 ms 8052 KB Output is partially correct - 353700 call(s) of encode_bit()
8 Correct 207 ms 7400 KB Output is partially correct - 339660 call(s) of encode_bit()
9 Correct 179 ms 7572 KB Output is partially correct - 353700 call(s) of encode_bit()
10 Correct 190 ms 7452 KB Output is partially correct - 353700 call(s) of encode_bit()
11 Correct 230 ms 7716 KB Output is partially correct - 353700 call(s) of encode_bit()
12 Correct 117 ms 7440 KB Output is partially correct - 353700 call(s) of encode_bit()
13 Correct 304 ms 8200 KB Output is partially correct - 353700 call(s) of encode_bit()
14 Correct 162 ms 7548 KB Output is partially correct - 353700 call(s) of encode_bit()
15 Correct 163 ms 7568 KB Output is partially correct - 353700 call(s) of encode_bit()
16 Correct 236 ms 8000 KB Output is partially correct - 353700 call(s) of encode_bit()
17 Correct 231 ms 8116 KB Output is partially correct - 353700 call(s) of encode_bit()
18 Correct 282 ms 8460 KB Output is partially correct - 353700 call(s) of encode_bit()
19 Correct 251 ms 7808 KB Output is partially correct - 353700 call(s) of encode_bit()
20 Correct 312 ms 8584 KB Output is partially correct - 353700 call(s) of encode_bit()
21 Correct 343 ms 8788 KB Output is partially correct - 353700 call(s) of encode_bit()
22 Correct 293 ms 8216 KB Output is partially correct - 353700 call(s) of encode_bit()
23 Correct 361 ms 8956 KB Output is partially correct - 353700 call(s) of encode_bit()
# 결과 실행 시간 메모리 Grader output
1 Correct 652 ms 12280 KB Output is partially correct - 353700 call(s) of encode_bit()
2 Correct 2 ms 4604 KB Output is correct - 120 call(s) of encode_bit()
3 Correct 206 ms 7328 KB Output is partially correct - 317700 call(s) of encode_bit()
4 Correct 2 ms 4608 KB Output is correct - 150 call(s) of encode_bit()
5 Correct 206 ms 7456 KB Output is partially correct - 317700 call(s) of encode_bit()
6 Correct 242 ms 7748 KB Output is partially correct - 353700 call(s) of encode_bit()
7 Correct 283 ms 8052 KB Output is partially correct - 353700 call(s) of encode_bit()
8 Correct 207 ms 7400 KB Output is partially correct - 339660 call(s) of encode_bit()
9 Correct 179 ms 7572 KB Output is partially correct - 353700 call(s) of encode_bit()
10 Correct 190 ms 7452 KB Output is partially correct - 353700 call(s) of encode_bit()
11 Correct 230 ms 7716 KB Output is partially correct - 353700 call(s) of encode_bit()
12 Correct 117 ms 7440 KB Output is partially correct - 353700 call(s) of encode_bit()
13 Correct 304 ms 8200 KB Output is partially correct - 353700 call(s) of encode_bit()
14 Correct 162 ms 7548 KB Output is partially correct - 353700 call(s) of encode_bit()
15 Correct 163 ms 7568 KB Output is partially correct - 353700 call(s) of encode_bit()
16 Correct 236 ms 8000 KB Output is partially correct - 353700 call(s) of encode_bit()
17 Correct 231 ms 8116 KB Output is partially correct - 353700 call(s) of encode_bit()
18 Correct 282 ms 8460 KB Output is partially correct - 353700 call(s) of encode_bit()
19 Correct 251 ms 7808 KB Output is partially correct - 353700 call(s) of encode_bit()
20 Correct 312 ms 8584 KB Output is partially correct - 353700 call(s) of encode_bit()
21 Correct 343 ms 8788 KB Output is partially correct - 353700 call(s) of encode_bit()
22 Correct 293 ms 8216 KB Output is partially correct - 353700 call(s) of encode_bit()
23 Correct 361 ms 8956 KB Output is partially correct - 353700 call(s) of encode_bit()