QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#673767 | #5270. Easily Distinguishable Triangles | IllusionaryDominance# | WA | 0ms | 3648kb | C++20 | 973b | 2024-10-25 09:59:29 | 2024-10-25 09:59:31 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
int n;
string s[1010];
int main(){
ios::sync_with_stdio(0); cin.tie(0), cout.tie(0);
cin >> n;
for (int i = 1; i <= n; ++ i) {
// cin >> (s[i] + 1);
cin >> s[i]; s[i] = ' ' + s[i] + "\0\0";
}
for (int i = 0; i <= n + 1; ++ i) s[0][i] = s[i][0] = s[n + 1][i] = s[i][n + 1] = '.';
long long ans = 1;
for (int i = 1; i <= n; ++ i){
int be = 0;
for (int j = 1; j <= n + 1; ++ j){
if(s[i][j] != '?'){
if(be != j - 1 && s[i][j] == s[i][be])(ans *= (s[i][j] == '.') * 2) %= MOD;
be = j;
}
}
be = 0;
for (int j = 1; j <= n + 1; ++ j){
if(s[j][i] != '?'){
if(be != j - 1 && s[j][i] == s[be][i])(ans *= (s[j][i] == '.') * 2) %= MOD;
be = j;
}
}
}
cout << ans;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
input:
2 .? ?#
output:
4
result:
ok 1 number(s): "4"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
3 #?? #?? ?##
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
3 .#. #?# .#.
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
1 .
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
1 #
output:
1
result:
ok 1 number(s): "1"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
1 ?
output:
4
result:
ok 1 number(s): "4"
Test #7:
score: -100
Wrong Answer
time: 0ms
memory: 3580kb
input:
2 ?. ?.
output:
8
result:
wrong answer 1st numbers differ - expected: '12', found: '8'