QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#357249 | #404. Solitaire | bonkar | 0 | 0ms | 0kb | C++14 | 1.1kb | 2024-03-18 19:38:43 | 2024-03-18 19:38:43 |
answer
/* Generated by the powerful Sio Tool
* You can download the binary file here: https://github.com/Arapak/sio-tool
* Author: (Karol Bonat)
* Time of creation: 2024-03-18 10:40:09
* Notes:
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int MAXN = 1000006;
int n;
bool pla[5][MAXN];
bool ter[5][MAXN];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n;
vector<pair<int, int>> pus;
for(int i = 1; i <= 3; i++){
for(int j = 1; j <= n; j++){
char t;
cin >> t;
pla[i][j] = (t=='o');
if(t=='x') pus.push_back({i, j});
}
}
int r = 0;
do{
for(int i = 1; i <= 3; i++){
for(int j = 1; j <= n; j++){
ter[i][j] = pla[i][j];
}
}
bool ok = 1;
for(auto t : pus){
if((ter[t.first+1][t.second] && ter[t.first-1][t.second]) || (ter[t.first][t.second+1] && ter[t.first][t.second-1])){
ter[t.first][t.second]=1;
}
else{
ok=0;
break;
}
}
r+=ok;
} while(next_permutation(pus.begin(), pus.end()));
cout << r << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
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%