Submission #591437

# Submission time Handle Problem Language Result Execution time Memory
591437 2022-07-07T12:34:56 Z Vanilla Unscrambling a Messy Bug (IOI16_messy) C++17
20 / 100
1 ms 304 KB
#include <bits/stdc++.h>
#include "messy.h"
#include <vector>
using namespace std;

vector<int> restore_permutation(int n, int w, int r) {
    if (n == 8) {
        vector <int> frq(128);
        string s = "";
        for (int i = 0; i < n; i++){
            s.push_back('1');
        }
        for (int i = 0; i < n; i++){
            add_element(s);
            s[i] = '0';
        }
        compile_set();
        for (int i = 0; i < 256; i++){
            string s = "";
            for (int j = 0; j < 8; j++){
                s = char('0' + !!(i & (1 << j))) + s;
            }
            if(check_element(s)) {
                for (int j = 0; j < 8; j++){
                    if (s[j] == '1') frq[j]++;
                }
            }
        }
        vector <int> p (n);
        for (int i = 0; i < n; i++){
            p[i] = frq[i] - 1;
        }
        return p;
    }
    else if (n == 32) {
        string s = "";
        for (int i = 0; i < n; i++){
            s.push_back('1');
        }
        for (int i = 0; i < n; i++){
            add_element(s);
            s[i] = '0';
        }
        compile_set();
        s = "";
        for (int i = 0; i < n; i++) {
            s.push_back('1');
        }
        vector <int> p (32);
        for (int i = 0; i < n; i++){
            vector <int> v;
            for (int j = 0; j < n; j++) v.push_back(j);
            shuffle(v.begin(), v.end(), std::default_random_engine(chrono::system_clock::now().time_since_epoch().count()));
            for (int j = 0; j < n; j++){
                if (s[v[j]] == '1') {
                    s[v[j]] = '0';
                    if (check_element(s)) {
                        p[v[j]] = i;
                        break;
                    }
                    s[v[j]] = '1';
                }
            }
        }
        return p;
    }
    return vector <int> ();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB n = 8
2 Correct 1 ms 212 KB n = 8
3 Correct 0 ms 300 KB n = 8
4 Correct 0 ms 212 KB n = 8
5 Correct 1 ms 296 KB n = 8
6 Correct 1 ms 212 KB n = 8
7 Correct 1 ms 300 KB n = 8
8 Correct 1 ms 212 KB n = 8
9 Correct 1 ms 304 KB n = 8
10 Correct 1 ms 292 KB n = 8
11 Correct 1 ms 212 KB n = 8
12 Correct 1 ms 300 KB n = 8
13 Correct 1 ms 212 KB n = 8
14 Correct 1 ms 212 KB n = 8
15 Correct 1 ms 300 KB n = 8
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 296 KB grader returned WA
2 Halted 0 ms 0 KB -