Submission #1298203

#TimeUsernameProblemLanguageResultExecution timeMemory
1298203tudor_costinUnscrambling a Messy Bug (IOI16_messy)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "messy.h"
using namespace std;
bitset<200> viz;
bool check(string x,int poz)
{
    x[poz]='1';
    return check_element(x);
}
vector<int> restore_permutation(int n,int w,int r)
{
    string x="";
    for(int i=0;i<n;i++) x=x+'0';
    for(int i=0;i<n-1;i++)
    {
        x[i]='1';
        add_element(x);
    }
    compile_set();
    vector<int> perm(n);
    string cur="";
    for(int i=0;i<n;i++) curs=cur+'0';
    for(int bit=1;bit<n;bit++)
    {
        bitset<200> cur=viz;
        int goodbit=0;
        while(true)
        {
            int nwbit=rand()%n;
            if(cur[nwbit]) continue;
            if(check(curs,nwbit))
            {
                goodbit=nwbit;
                break;
            }
            else cur[nwbit]=1;
        }
        perm[goodbit]=bit-1;
        curs[goodbit]='1';
        viz[goodbit]=1;
    }
    for(int i=0;i<n;i++) if(!viz[i]) perm[i]=n-1;
    return perm;
}

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:22:26: error: 'curs' was not declared in this scope; did you mean 'cur'?
   22 |     for(int i=0;i<n;i++) curs=cur+'0';
      |                          ^~~~
      |                          cur
messy.cpp:31:22: error: 'curs' was not declared in this scope; did you mean 'cur'?
   31 |             if(check(curs,nwbit))
      |                      ^~~~
      |                      cur
messy.cpp:39:9: error: 'curs' was not declared in this scope; did you mean 'cur'?
   39 |         curs[goodbit]='1';
      |         ^~~~
      |         cur
messy.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
messy_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~