Submission #65243

# Submission time Handle Problem Language Result Execution time Memory
65243 2018-08-07T06:32:44 Z FedericoS Unscrambling a Messy Bug (IOI16_messy) C++14
20 / 100
2 ms 512 KB
#include <vector>
#include <iostream>
#include <assert.h>
#include "messy.h"
using namespace std;

int q;

bool controlla(string g){
    q++;
    assert(q<=1024);
    return check_element(g);
}

vector<int> restore_permutation(int N, int w, int r) {

    if(N!=8)assert(N==32 and w==320 and r==1024);

    vector<int> P(N,-1);
    string S(N,'0');

    for(int i=0;i<N;i++){
        S[i]='1';
        add_element(S);
    }

    compile_set();

    string R(N,'0');

    for(int i=0;i<N;i++)
        for(int j=0;j<N;j++)
            if(R[j]=='0'){
                R[j]='1';
                if(controlla(R)){
                    P[i]=j;
                    break;
                }
                else
                    R[j]='0';
            }

    for(int x:P)
        assert(x!=-1);

    return P;
}
/*
32 320 1024
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
*/
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB n = 8
2 Correct 2 ms 384 KB n = 8
3 Correct 2 ms 256 KB n = 8
4 Correct 2 ms 384 KB n = 8
5 Correct 2 ms 384 KB n = 8
6 Correct 2 ms 384 KB n = 8
7 Correct 2 ms 384 KB n = 8
8 Correct 2 ms 256 KB n = 8
9 Correct 2 ms 384 KB n = 8
10 Correct 2 ms 256 KB n = 8
11 Correct 2 ms 384 KB n = 8
12 Correct 2 ms 384 KB n = 8
13 Correct 2 ms 384 KB n = 8
14 Correct 2 ms 384 KB n = 8
15 Correct 2 ms 256 KB n = 8
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -