Submission #709390

#TimeUsernameProblemLanguageResultExecution timeMemory
709390ssenseUnscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
1 ms340 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>
 
vector<int> restore_permutation(int n, int w, int r)
{
    string now;
    for(int i = 0; i < n; i++)
    {
        now.push_back('0');
    }
    for(int i = 0; i < n; i++)
    {
        now[i]++;
        assert(w != 0);
        assert(now.size() == n);
        add_element(now);
        w--;
    }
    compile_set();
    vector<string> bits;
    vint ans(n);
    string already;
    for(int i = 0; i < n; i++)
    {
        already.push_back('0');
    }
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < n; j++)
        {
            if(already[j] == '0')
            {
                string x = already;
                x[j]++;
                assert(r != 0);
                assert(x.size() == n);
                if(check_element(x))
                {
                    ans[i] = j;
                    already = x;
                    break;
                }
                r--;
            }
        }
    }
    vint ans2(n);
    for(int i = 0; i < n; i++)
    {
        ans2[ans[i]] = i;
    }
    return ans2;
}
/*
int32_t main(){
    startt
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}
 
 
*/

Compilation message (stderr)

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from messy.cpp:1:
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:19:27: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |         assert(now.size() == n);
      |                ~~~~~~~~~~~^~~~
messy.cpp:40:33: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   40 |                 assert(x.size() == n);
      |                        ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...