Submission #853670

# Submission time Handle Problem Language Result Execution time Memory
853670 2023-09-25T01:33:11 Z hgmhc Unscrambling a Messy Bug (IOI16_messy) C++17
20 / 100
2 ms 348 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__)

inline vi flip(vi v, int k) { v[k] ^= 1; return v; }
inline string str(vi v) {
    string r;
    for (const auto &e : v) r += '0'+e;
    return r;
}

vi restore_permutation(int n, int w, int r) {
    rep(i,1,n) add_element(string(i,'1')+string(n-i,'0'));
    compile_set();
    vi p(n), b(n), ch(n);
    rep(i,0,n-1) {
        rep(j,0,n-1) if (!ch[j]) {
            if (check_element(str(flip(b,j)))) {
                ch[j] = 1;
                p[i] = j;
                b[j] = 1;
                break;
            }
        }
    }
    return p;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB n = 8
2 Correct 0 ms 348 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 344 KB n = 8
7 Correct 1 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 1 ms 348 KB n = 8
14 Correct 0 ms 348 KB n = 8
15 Correct 0 ms 348 KB n = 8
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB n = 32
2 Correct 0 ms 348 KB n = 32
3 Incorrect 1 ms 348 KB grader returned WA
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB grader returned WA
2 Halted 0 ms 0 KB -