Submission #276264

# Submission time Handle Problem Language Result Execution time Memory
276264 2020-08-20T11:47:36 Z brcode Unscrambling a Messy Bug (IOI16_messy) C++14
20 / 100
1 ms 384 KB
#include <iostream>
#include <bits/stdc++.h>
#include "messy.h"
using namespace std;
const int MAXN = 5010;
bool blocked[MAXN];
vector<int> v1;
vector<int> restore_permutation(int bits,int r,int w){
    vector<int> p(bits);
    string s="";
    s+='1';
    for(int i=2;i<=bits;i++){
        s+='0';
    }
    add_element(s);
    for(int i=1;i<bits;i++){
        s[i] = '1';
        add_element(s);
    }
    compile_set();
    s = "";
    for(int i=1;i<=bits;i++){
        s+='0';
    }
    for(int i=0;i<bits;i++){
        int currbit = -1;
        for(int j=0;j<bits;j++){
            if(blocked[j]){
                continue;
            }
            s[j] = '1';
            if(check_element(s)){
                p[i] = j;
                blocked[j]=true;
                v1.push_back(p[i]);
                break;
            }
            s[j] = '0';
        }
        for(int j=0;j<bits;j++){
            s[j] = '0';
        }
        for(int x:v1){
            s[x] = '1';
        }
    }
    return p;
}

Compilation message

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:26:13: warning: unused variable 'currbit' [-Wunused-variable]
   26 |         int currbit = -1;
      |             ^~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB n = 8
2 Correct 1 ms 256 KB n = 8
3 Correct 1 ms 256 KB n = 8
4 Correct 1 ms 256 KB n = 8
5 Correct 1 ms 256 KB n = 8
6 Correct 0 ms 256 KB n = 8
7 Correct 1 ms 256 KB n = 8
8 Correct 1 ms 256 KB n = 8
9 Correct 1 ms 256 KB n = 8
10 Correct 0 ms 256 KB n = 8
11 Correct 1 ms 256 KB n = 8
12 Correct 1 ms 256 KB n = 8
13 Correct 1 ms 384 KB n = 8
14 Correct 1 ms 256 KB n = 8
15 Correct 0 ms 256 KB n = 8
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB n = 32
2 Correct 1 ms 288 KB n = 32
3 Incorrect 1 ms 256 KB grader returned WA
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB grader returned WA
2 Halted 0 ms 0 KB -