QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#357439 | #404. Solitaire | k27radek# | 0 | 0ms | 0kb | C++20 | 1.1kb | 2024-03-18 21:15:18 | 2024-03-18 21:15:19 |
Judging History
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%