답안 #957485

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
957485 2024-04-03T21:13:30 Z aykhn Unscrambling a Messy Bug (IOI16_messy) C++17
100 / 100
5 ms 856 KB
#include <bits/stdc++.h>
#include "messy.h"

using namespace std;

int n;
vector<int> ans;

void create(int l, int r)
{
    if (l + 1 == r) return;
    string s(n, '1');
    for (int i = l; i < r; i++) s[i] = '0';
    for (int i = l; i < ((l + r) >> 1); i++)
    {
        s[i] = '1';
        add_element(s);
        s[i] = '0';
    }
    create(l, (l + r) >> 1);
    create((l + r) >> 1, r);
}

void getans(int l, int r, vector<int> v)
{
    if (l + 1 == r)
    {
        ans[v[0]] = l;
        return;
    }
    string s(n, '1');
    for (int i : v) s[i] = '0';
    vector<int> V[2];
    for (int i : v)
    {
        s[i] = '1';
        int x = check_element(s);
        s[i] = '0';
        if (x) V[0].push_back(i);
        else V[1].push_back(i);
    }
    getans(l, (l + r) >> 1, V[0]);
    getans((l + r) >> 1, r, V[1]);
}

vector<int> restore_permutation(int N, int w, int r) 
{
    n = N;
    create(0, n);
    compile_set();
    vector<int> v(n, 0);
    iota(v.begin(), v.end(), 0);
    ans.assign(n, 0);
    getans(0, n, v);
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB n = 8
2 Correct 0 ms 348 KB n = 8
3 Correct 0 ms 408 KB n = 8
4 Correct 0 ms 348 KB n = 8
5 Correct 1 ms 412 KB n = 8
6 Correct 0 ms 344 KB n = 8
7 Correct 0 ms 348 KB n = 8
8 Correct 0 ms 348 KB n = 8
9 Correct 0 ms 348 KB n = 8
10 Correct 0 ms 348 KB n = 8
11 Correct 0 ms 348 KB n = 8
12 Correct 0 ms 348 KB n = 8
13 Correct 0 ms 348 KB n = 8
14 Correct 0 ms 348 KB n = 8
15 Correct 0 ms 348 KB n = 8
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB n = 32
2 Correct 1 ms 348 KB n = 32
3 Correct 1 ms 348 KB n = 32
4 Correct 1 ms 348 KB n = 32
5 Correct 1 ms 436 KB n = 32
6 Correct 0 ms 348 KB n = 32
7 Correct 0 ms 348 KB n = 32
8 Correct 1 ms 344 KB n = 32
9 Correct 0 ms 436 KB n = 32
10 Correct 0 ms 348 KB n = 32
11 Correct 1 ms 348 KB n = 32
12 Correct 1 ms 344 KB n = 32
13 Correct 1 ms 348 KB n = 32
14 Correct 1 ms 348 KB n = 32
15 Correct 1 ms 344 KB n = 32
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB n = 32
2 Correct 1 ms 348 KB n = 32
3 Correct 1 ms 348 KB n = 32
4 Correct 0 ms 348 KB n = 32
5 Correct 0 ms 604 KB n = 32
6 Correct 0 ms 348 KB n = 32
7 Correct 0 ms 348 KB n = 32
8 Correct 0 ms 348 KB n = 32
9 Correct 0 ms 348 KB n = 32
10 Correct 0 ms 348 KB n = 32
11 Correct 1 ms 348 KB n = 32
12 Correct 0 ms 348 KB n = 32
13 Correct 1 ms 348 KB n = 32
14 Correct 0 ms 348 KB n = 32
15 Correct 0 ms 348 KB n = 32
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB n = 128
2 Correct 1 ms 604 KB n = 128
3 Correct 1 ms 604 KB n = 128
4 Correct 1 ms 604 KB n = 128
5 Correct 1 ms 604 KB n = 128
6 Correct 1 ms 584 KB n = 128
7 Correct 1 ms 856 KB n = 128
8 Correct 1 ms 604 KB n = 128
9 Correct 1 ms 604 KB n = 128
10 Correct 1 ms 604 KB n = 128
11 Correct 1 ms 604 KB n = 128
12 Correct 1 ms 604 KB n = 128
13 Correct 1 ms 600 KB n = 128
14 Correct 1 ms 604 KB n = 128
15 Correct 1 ms 604 KB n = 128
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 604 KB n = 128
2 Correct 1 ms 604 KB n = 128
3 Correct 1 ms 432 KB n = 128
4 Correct 1 ms 436 KB n = 128
5 Correct 1 ms 600 KB n = 128
6 Correct 1 ms 856 KB n = 128
7 Correct 5 ms 604 KB n = 128
8 Correct 1 ms 440 KB n = 128
9 Correct 1 ms 604 KB n = 128
10 Correct 1 ms 604 KB n = 128
11 Correct 1 ms 604 KB n = 128
12 Correct 1 ms 600 KB n = 128
13 Correct 2 ms 604 KB n = 128
14 Correct 1 ms 604 KB n = 128
15 Correct 1 ms 604 KB n = 128