QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#71357 | #5270. Easily Distinguishable Triangles | neko_nyaa# | WA | 2ms | 3452kb | C++20 | 991b | 2023-01-09 20:35:49 | 2023-01-09 20:35:51 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int M = 998244353;
signed main() {
ios::sync_with_stdio(0); cin.tie(0);
int n; cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
}
int ans = 1;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (s[i][j] == '?') {
int l = j, r = j;
while (r < n && s[i][r] == '?') {
r++;
}
r--;
int bd = 2;
if (l > 0 && s[i][l-1] == '#') bd--;
if (r+1 < n && s[i][r+1] == '#') bd--;
ans = ans*bd % M;
j = r;
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (s[j][i] == '?') {
int l = j, r = j;
while (r < n && s[r][i] == '?') {
r++;
}
r--;
int bd = 2;
if (l > 0 && s[l-1][i] == '#') bd--;
if (r+1 < n && s[r+1][i] == '#') bd--;
ans = ans*bd % M;
j = r;
}
}
}
cout << ans << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3440kb
input:
2 .? ?#
output:
4
result:
ok 1 number(s): "4"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3440kb
input:
3 #?? #?? ?##
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 2ms
memory: 3452kb
input:
3 .#. #?# .#.
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 2ms
memory: 3308kb
input:
1 .
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 2ms
memory: 3404kb
input:
1 #
output:
1
result:
ok 1 number(s): "1"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3380kb
input:
1 ?
output:
4
result:
ok 1 number(s): "4"
Test #7:
score: -100
Wrong Answer
time: 2ms
memory: 3440kb
input:
2 ?. ?.
output:
8
result:
wrong answer 1st numbers differ - expected: '12', found: '8'