Submission #585831

# Submission time Handle Problem Language Result Execution time Memory
585831 2022-06-29T11:57:10 Z 1zaid1 Pipes (CEOI15_pipes) C++14
0 / 100
62 ms 552 KB
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'

const int M = 1e5+5;
int mx = 0;
string s;
struct dna {string s = ""; array<int, 4> ar = {0,0,0,0};
int& operator[](int x) {return ar[x];}};
bool operator-(dna d) {return d[0]%2 + d[1]%2 + d[2]%2 + d[3]%2==0;}
void agct(int n = 0, dna d = {"", {0,0,0,0}}) {
    for (char i:"abcd") {
        d.s += i;
        bool ok = 1;
        dna tmp = {"", {0,0,0,0}};
        for (int i = n; i >= 0; i--) {
            tmp[d.s[i]-'a']++;
            if (-tmp) {
                ok = 0;
                break;
            }
        } d[i-'a']++;

        if (ok) {
            cout << n+1 << endl;
        if (n+1 > mx) {
            mx = n+1;
            s = d.s;
        }
        agct(n+1, d);}
        d.s.pop_back();
        d[i-'a']--;
    }
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    srand(time(0));
    
    agct();
    cout << mx << endl;
    cout << s << endl;
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 520 KB Expected integer, but "abacabadabacaba" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 516 KB Expected integer, but "abacabadabacaba" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 504 KB Expected integer, but "abacabadabacaba" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 59 ms 480 KB Expected integer, but "abacabadabacaba" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 504 KB Expected integer, but "abacabadabacaba" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 552 KB Expected integer, but "abacabadabacaba" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 60 ms 512 KB Expected integer, but "abacabadabacaba" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 432 KB Expected integer, but "abacabadabacaba" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 61 ms 476 KB Expected integer, but "abacabadabacaba" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 58 ms 552 KB Expected integer, but "abacabadabacaba" found
2 Halted 0 ms 0 KB -