제출 #430243

#제출 시각아이디문제언어결과실행 시간메모리
430243LouayFarahUnscrambling a Messy Bug (IOI16_messy)C++14
0 / 100
1 ms460 KiB
#include "bits/stdc++.h"
#include "messy.h"
using namespace std;

#define pb push_back

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

vector<int> restore_permutation(int n, int w, int r)
{
    if(n==8)
    {
        vector<string> li;
        string s = "00000000";
        for(int i = 7; i>=0; i--)
        {
            for(int j = i-1; j>=0; j--)
            {
                s[j] = '1';
                li.pb(s);
                s[j] = '0';
            }
            s[i] = '1';
        }

        int len = (int)li.size();
        for(int i = 0; i<len; i++)
            add_element(li[i]);

        compile_set();

        vector<int> res;
        for(int i = 0; i<8; i++)
            res.pb(i);

        for(int i = 7; i>=0; i--)
        {
            for(int j = i-1; j>=0; j--)
            {
                string s1 = "00000000";
                string s2 = s1;
                s1[j] = '1';
                for(int k = i+1; k<8; k++)
                    s1[k] = '1';

                for(int k = i; k<n; k++)
                    s2[k] = '1';
                if(!check_element(s1)&&check_element(s2))
                {
                    swap(res[i], res[j]);
                    return res;
                }
            }
        }
    }
    if(n==32&&w==320)
    {

    }
    if(n==32&&r==320)
    {

    }
}

컴파일 시 표준 에러 (stderr) 메시지

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:62:13: warning: control reaches end of non-void function [-Wreturn-type]
   62 |     if(n==32&&r==320)
      |        ~~~~~^~~~~~~~
#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...