Submission #953596

# Submission time Handle Problem Language Result Execution time Memory
953596 2024-03-26T09:52:04 Z irmuun Unscrambling a Messy Bug (IOI16_messy) C++17
0 / 100
1 ms 348 KB
#include<bits/stdc++.h>
#include "messy.h"

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

vector<int> restore_permutation(int n, int w, int r){
    if(n==8){
        vector<int>p(n);
        string s(n,'0');
        for(int i=n-1;i>=0;i--){
            add_element(s);
            s[i]='1';
        }
        compile_set();
        vector<int>cnt(n,0);
        for(int i=0;i<(1<<n);i++){
            string t="";
            for(int j=0;j<n;j++){
                if(i&(1<<j)) t+='0';
                else t+='1';
            }
            if(check_element(t)){
                for(int j=0;j<n;j++){
                    if(!i&(1<<j)){
                        cnt[j]++;
                    }
                }
            }
        }
        for(int i=0;i<n;i++){
            p[cnt[i]]=i;
        }
        return p;
    }
    return {};
}

Compilation message

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:31:24: warning: suggest parentheses around operand of '!' or change '&' to '&&' or '!' to '~' [-Wparentheses]
   31 |                     if(!i&(1<<j)){
      |                        ^~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB grader returned WA
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 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 -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 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 -