답안 #172646

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
172646 2020-01-02T09:22:04 Z emil_physmath "The Lyuboyn" code (IZhO19_lyuboyn) C++17
11 / 100
775 ms 26004 KB
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
using namespace std;

vector<string> a;

void Get(int n, int k)
{
    // cerr << n << ", " << k << endl;
    if (k == 1)
    {
        if (n == 1)
        {
            a.resize(2);
            a[0] = "0";
            a[1] = "1";
            return;
        }
        Get(n - 1, k);
        a.resize(2 * a.size());
        for (int i = 0; i < a.size(); ++i)
        {
            a[i].insert(a[i].begin(), (i < a.size() / 2 ? '0' : '1'));
            a[i].resize(n);
        }
        for (int j = 1; j < n; ++j)
            for (int r = a.size() / 2, l = a.size() / 2 - 1; r < a.size(); ++r, --l)
                a[r][j] = a[l][j];
    }
}
int main()
{
    int n, k, t;
    cin >> n >> k >> t;
    string s;
    cin >> s;
    Get(n, k);
    cout << a.size() << endl;
    for (auto it = find(a.begin(), a.end(), s); it != a.end(); ++it)
        cout << *it << endl;
    for (int i = 0; a[i] != s; ++i)
        cout << a[i] << endl;
}

Compilation message

lyuboyn.cpp: In function 'void Get(int, int)':
lyuboyn.cpp:23:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < a.size(); ++i)
                         ~~^~~~~~~~~~
lyuboyn.cpp:25:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             a[i].insert(a[i].begin(), (i < a.size() / 2 ? '0' : '1'));
                                        ~~^~~~~~~~~~~~~~
lyuboyn.cpp:29:64: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int r = a.size() / 2, l = a.size() / 2 - 1; r < a.size(); ++r, --l)
                                                              ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 480 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 775 ms 26004 KB Ok
2 Correct 384 ms 13008 KB Ok
3 Correct 5 ms 376 KB Ok
4 Correct 2 ms 256 KB Ok
5 Correct 2 ms 256 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 775 ms 26004 KB Ok
2 Correct 384 ms 13008 KB Ok
3 Correct 5 ms 376 KB Ok
4 Correct 2 ms 256 KB Ok
5 Correct 2 ms 256 KB Ok
6 Runtime error 1 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -