답안 #796314

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
796314 2023-07-28T09:18:35 Z Shithila Unscrambling a Messy Bug (IOI16_messy) C++14
20 / 100
1 ms 340 KB
#include <bits/stdc++.h>

#include "messy.h"
using namespace std;
std::vector<int> restore_permutation(int n, int w, int r) {
    string x;
    string y;
    vector<int> ans;
    for(int i=0;i<n;i++)
    {
        x=x+'0';
    }
    y=x;
    for(int i=0;i<n;i++)
    {
        x[i]='1';
        add_element(x);
    }
    compile_set();
    while(ans.size()!=n)
    {
        for(int i=0;i<n;i++)
        {
            bool valid=true;
            for(int j=0;j<ans.size();j++)
            {
                if(i==ans[j])
                {
                    valid=false;
                    break;
                }
            }
            if(valid==false) continue;
            y[i]='1';
            bool produced=check_element(y);
            if(produced==true)
            {
                ans.push_back(i);
                break;
            }
            else y[i]='0';
        }
    }
    
    return ans;
}

Compilation message

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:20:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     while(ans.size()!=n)
      |           ~~~~~~~~~~^~~
messy.cpp:25:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             for(int j=0;j<ans.size();j++)
      |                         ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB n = 8
2 Correct 1 ms 212 KB n = 8
3 Correct 1 ms 304 KB n = 8
4 Correct 1 ms 212 KB n = 8
5 Correct 1 ms 300 KB n = 8
6 Correct 1 ms 212 KB n = 8
7 Correct 1 ms 212 KB n = 8
8 Correct 1 ms 212 KB n = 8
9 Correct 1 ms 212 KB n = 8
10 Correct 1 ms 212 KB n = 8
11 Correct 1 ms 212 KB n = 8
12 Correct 1 ms 212 KB n = 8
13 Correct 0 ms 212 KB n = 8
14 Correct 0 ms 304 KB n = 8
15 Correct 1 ms 212 KB n = 8
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB grader returned WA
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB n = 32
2 Correct 1 ms 212 KB n = 32
3 Incorrect 0 ms 212 KB grader returned WA
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB grader returned WA
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB grader returned WA
2 Halted 0 ms 0 KB -