답안 #853668

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
853668 2023-09-25T00:52:30 Z hgmhc Unscrambling a Messy Bug (IOI16_messy) C++17
20 / 100
1 ms 436 KB
#include "messy.h"
#include <bits/stdc++.h>
using namespace std; using ii = pair<int,int>; using ll = long long; using vi = vector<int>;
#define rep(i,a,b) for (auto i = (a); i <= (b); ++i)
#define per(i,a,b) for (auto i = (b); i >= (a); --i)
#define all(x) begin(x), end(x)
#define siz(x) int((x).size())
#define Mup(x,y) x = max(x,y)
#define mup(x,y) x = min(x,y)
#define fi first
#define se second
#define dbg(...) fprintf(stderr,__VA_ARGS__)

vi restore_permutation(int n, int w, int r) {
    assert(n==8);
    rep(i,1,8) {
        add_element(string(n-i,'0')+string(i,'1'));
    }
    compile_set();
    vi p(n); iota(all(p),0);
    vi idx;
    int a=-1, b=-1;
    rep(i,0,7) {
        if (check_element(string(i,'0')+string(n-i,'1'))) {
            a = i;
        } else break;
    }
    rep(i,a+1,7) {
        if (!check_element(string(i,'0')+string(n-i,'1'))) {
            b = i;
        } else break;
    }
    if (a != -1 and b != -1) swap(p[a],p[b]);
    return p;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB n = 8
2 Correct 0 ms 344 KB n = 8
3 Correct 0 ms 348 KB n = 8
4 Correct 0 ms 348 KB n = 8
5 Correct 0 ms 348 KB n = 8
6 Correct 0 ms 348 KB n = 8
7 Correct 0 ms 348 KB n = 8
8 Correct 0 ms 348 KB n = 8
9 Correct 0 ms 436 KB n = 8
10 Correct 0 ms 344 KB n = 8
11 Correct 0 ms 344 KB n = 8
12 Correct 0 ms 348 KB n = 8
13 Correct 0 ms 436 KB n = 8
14 Correct 0 ms 348 KB n = 8
15 Correct 0 ms 348 KB n = 8
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -