Submission #709229

#TimeUsernameProblemLanguageResultExecution timeMemory
709229ssenseUnscrambling a Messy Bug (IOI16_messy)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "messy.h"
#define startt ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long  ll;
using namespace std;
#define vint vector<int>

int restore_permutation(int n, int w, int r, int* ans)
{
    int now = 0;
    for(int i = 0; i < 7; i++)
    {
        now+=(1<<i);
        add_element(now);
    }
    compile_set();
    vector<vint> bits(8);
    for(int i = 1; i <= 256; i++)
    {
        bits[__builtin_popcount(i)].push_back(i);
    }
    int already = 0;
    int idx = 0;
    for(auto v : bits)
    {
        for(auto x : v)
        {
            if(check_element(x))
            {
                int acc = x-already;
                ans[idx] = 31-__builtin_clz(acc);
                already = x;
                break;
            }
        }
        idx++;
    }
}
/*
int32_t main(){
    startt
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}


*/

Compilation message (stderr)

messy.cpp: In function 'int restore_permutation(int, int, int, int*)':
messy.cpp:14:21: error: could not convert 'now' from 'int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   14 |         add_element(now);
      |                     ^~~
      |                     |
      |                     int
messy.cpp:28:30: error: could not convert 'x' from 'int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   28 |             if(check_element(x))
      |                              ^
      |                              |
      |                              int
messy.cpp:38:1: warning: no return statement in function returning non-void [-Wreturn-type]
   38 | }
      | ^