Submission #23849

# Submission time Handle Problem Language Result Execution time Memory
23849 2017-05-26T17:32:49 Z Mamnoon_Siam Unscrambling a Messy Bug (IOI16_messy) C++14
38 / 100
3 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

void add_element(std::string x);
bool check_element(std::string x);
void compile_set();

std::vector<int> restore_permutation(int n, int w, int r)
{
    vector<int> ret=vector<int>(n);
    for(int i=0; i<n; i++) ret[i]=-1;
    string cur=string(n, '0');
    for(int i=n-1; i>0; i--) {
        cur[i]='1';
        add_element(cur);
    }
    compile_set();
    for(int i=0; i<cur.size(); i++) cur[i]='0';
    for(int pos=n-1; pos>0; pos--) {
        for(int i=0; i<n; i++) {
            if(cur[i]=='0') {
                string temp=cur; temp[i]='1';
                if(check_element(temp)==1) {
                    cur=temp;
                    ret[i]=pos;
                    goto siam;
                }
            }
        }
        siam : ;
    }
    for(int i=0; i<n; i++) {
        if(ret[i]==-1) {
            ret[i]=0;
            break;
        }
    }
    return ret;
}

Compilation message

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:18:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<cur.size(); i++) cur[i]='0';
                  ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB n = 8
2 Correct 2 ms 256 KB n = 8
3 Correct 2 ms 256 KB n = 8
4 Correct 2 ms 256 KB n = 8
5 Correct 2 ms 256 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 256 KB n = 8
10 Correct 2 ms 256 KB n = 8
11 Correct 2 ms 256 KB n = 8
12 Correct 2 ms 256 KB n = 8
13 Correct 2 ms 384 KB n = 8
14 Correct 2 ms 256 KB n = 8
15 Correct 2 ms 384 KB n = 8
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB n = 32
2 Correct 2 ms 384 KB n = 32
3 Correct 2 ms 384 KB n = 32
4 Correct 2 ms 384 KB n = 32
5 Correct 2 ms 384 KB n = 32
6 Correct 2 ms 324 KB n = 32
7 Correct 2 ms 256 KB n = 32
8 Correct 2 ms 256 KB n = 32
9 Correct 2 ms 256 KB n = 32
10 Correct 2 ms 256 KB n = 32
11 Correct 2 ms 356 KB n = 32
12 Correct 2 ms 256 KB n = 32
13 Correct 2 ms 256 KB n = 32
14 Correct 2 ms 256 KB n = 32
15 Correct 2 ms 256 KB n = 32
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB grader returned WA
2 Halted 0 ms 0 KB -