QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#357441#404. SolitaireAMongus21370 0ms0kbC++201.1kb2024-03-18 21:15:562024-03-18 21:15:57

Judging History

This is the latest submission verdict.

  • [2024-03-18 21:15:57]
  • Judged
  • Verdict: 0
  • Time: 0ms
  • Memory: 0kb
  • [2024-03-18 21:15:56]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
#define x first
#define y second
#define all(x) x.begin(), x.end()
#define len(x) (int)x.size()
int n;
vector<pii> rectangles;

array<string, 3> bo;

int brute(array<string, 3> &b)
{
    // cout << b[0] << "\n"
    //      << b[1] << "\n"
    //      << b[2] << "\n\n";
    int combinations = 0;
    int w = 0;
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (b[i][j] == 'x')
            {
                w++;
                if ((i == 1 && b[0][j] == 'o' && b[2][j] == 'o') || (j > 0 && j + 1 < n && b[i][j - 1] == 'o' && b[i][j + 1] == 'o'))
                {
                    b[i][j] = 'o';
                    combinations += brute(b);
                    b[i][j] = 'x';
                }
            }
        }
    }
    if (w == 0)
        return 1;
    else
        return combinations;
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0);
    cin >> n;
    cin >> bo[0] >> bo[1] >> bo[2];
    cout << brute(bo) << "\n";
}

/*

*/

詳細信息

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 0
Time Limit Exceeded

input:

21
ooooxoooooxoooooxoooo
oooxooooooooxxxxxooxo
ooxooooooooooooooooxo

output:


result:


Subtask #2:

score: 0
Time Limit Exceeded

Test #13:

score: 0
Time Limit Exceeded

input:

880
ooxooooooxoxoooxoxoooooxooxooooxoxooooooooooooooxooooooxoxooooxooooxoxooooooxoxooooooooooxoxooooxooxooxoooooooooooxoxoooooxoooooxoxoxooxoooxooxooooxooooxoxoxoooxoooooxoooxooxoxoooooooxooooxooooooxooooxoxooxoooooxoxooooxooxooooooooooooooxoooooooooooxooooooooooooooxooooxoxoxooooooxooooooooxooooxoo...

output:


result:


Subtask #3:

score: 0
Time Limit Exceeded

Test #38:

score: 0
Time Limit Exceeded

input:

27
oxooooxooooooxoooxoooooxoxo
xxooxooooxxxoxoooxooxxxxxoo
ooxoxoxoxoooxoxooooxoxooxoo

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%