제출 #95660

#제출 시각아이디문제언어결과실행 시간메모리
95660dwscUnscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
3 ms384 KiB
#include "messy.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> restore_permutation(int n, int w, int r) {
    int solved[n] = {0};
    for (int i = 0; i < n; i++){
        string s = "";
        for (int j = 0; j <= i; j++) s += '1';
        for (int j = i+1; j < n; j++) s += '0';
        add_element(s);
        //cout << s << "hi\n";
    }
    compile_set();
    vector<int> perm;
    for (int i  =0; i < n; i++) perm.push_back(-1);
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n; j++){
            if (perm[j] != -1) continue;
            string s = "";
            for (int k = 0; k < n; k++){
                if (perm[k] != -1){
                    s += '1';
                }
                else if (k == j) s += '1';
                else s += '0';
            }
            //cout << s <<" " << "\n";
            if (check_element(s)){
               // cout << j << "hi\n";
                perm[j] = i;
                break;
            }
        }
    }
    return perm;
}

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

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:5:9: warning: unused variable 'solved' [-Wunused-variable]
     int solved[n] = {0};
         ^~~~~~
#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...