Submission #117849

# Submission time Handle Problem Language Result Execution time Memory
117849 2019-06-17T08:59:49 Z 이온조(#2879) Ljetopica (COI19_ljetopica) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

const int MOD = 1e9 + 7;
int N, D[1009][1009], ans = 0;
char S[1009], A[1009], B[1009];
vector<string> S;
vector<int> C;
string stk = "";

void make(int id, int le, bool iv, int s) {
    if(id == N) {
        S.push_back(stk);
        C.push_back(s);
        return;
    }
    if(iv) stk.push_back('L' - S[id] + 'R');
    else stk.push_back(S[id]);
    make(id+1, le, iv, (stk.back() == 'L' ? s*2%MOD : (s*2+1)%MOD));
    stk.pop_back();

    if(le) iv = !iv;

    if(iv) stk.push_back('L' - S[id] + 'R');
    else stk.push_back(S[id]);
    make(id+1, le - 1, iv, (stk.back() == 'L' ? s*2%MOD : (s*2+1)%MOD));
    stk.pop_back();
}

int main() {
    int K; scanf("%d%d",&N,&K);
    scanf(" %s %s %s", S+1, A, B);
    if(K == 0) {
        int s = 1, ans = 0;
        bool a = 1, b = 1;
        for(int i=1; i<N; i++) {
            if(S[i] == 'L') {
                s *= 2; s %= MOD;
                if(a && A[i] == '1') goto hell1;
                if(B[i] == '1') b = 0;
            }
            if(S[i] == 'R') {
                s = s * 2 + 1; s %= MOD;
                if(b && B[i] == '0') goto hell1;
                if(A[i] == '0') a = 0;
            }
        }
        ans += s;
        hell1:;
        s = 1;
        a = 1, b = 1;
        for(int i=1; i<N; i++) {
            if(S[i] == 'R') {
                s *= 2; s %= MOD;
                if(a && A[i] == '1') goto hell2;
                if(B[i] == '1') b = 0;
            }
            if(S[i] == 'L') {
                s = s * 2 + 1; s %= MOD;
                if(b && B[i] == '0') goto hell2;
                if(A[i] == '0') a = 0;
            }
        }
        ans += s; ans %= MOD;
        hell2:;
        printf("%d", ans);
    }
    if(N <= 25) {
        make(1, K, 0, 1);
        make(1, K, 1, 1);
        for(auto& it: S) {
            bool a = 1, b = 1;
            for(int i=0; i<it.size(); i++) {
                if(it[i] == 'L') {
                    if(a && A[i+1])
                }
            }
        }
    }
    return 0;
}

Compilation message

ljetopica.cpp:7:16: error: conflicting declaration 'std::vector<std::__cxx11::basic_string<char> > S'
 vector<string> S;
                ^
ljetopica.cpp:6:6: note: previous declaration as 'char S [1009]'
 char S[1009], A[1009], B[1009];
      ^
ljetopica.cpp: In function 'void make(int, int, bool, int)':
ljetopica.cpp:13:11: error: request for member 'push_back' in 'S', which is of non-class type 'char [1009]'
         S.push_back(stk);
           ^~~~~~~~~
ljetopica.cpp: In function 'int main()':
ljetopica.cpp:73:31: error: request for member 'size' in 'it', which is of non-class type 'char'
             for(int i=0; i<it.size(); i++) {
                               ^~~~
ljetopica.cpp:74:24: error: invalid types 'char[int]' for array subscript
                 if(it[i] == 'L') {
                        ^
ljetopica.cpp:76:17: error: expected primary-expression before '}' token
                 }
                 ^
ljetopica.cpp:72:25: warning: unused variable 'b' [-Wunused-variable]
             bool a = 1, b = 1;
                         ^
ljetopica.cpp:31:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int K; scanf("%d%d",&N,&K);
            ~~~~~^~~~~~~~~~~~~~
ljetopica.cpp:32:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf(" %s %s %s", S+1, A, B);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~