QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#673775#5270. Easily Distinguishable TrianglesIllusionaryDominance#RE 0ms3828kbC++20987b2024-10-25 10:04:052024-10-25 10:04:07

Judging History

你现在查看的是最新测评结果

  • [2024-10-25 10:04:07]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:3828kb
  • [2024-10-25 10:04:05]
  • 提交

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] == '.') * (j - be)) %= 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] == '.') * (j - be)) %= MOD;
                be = j;
            }
        }
    }
    cout << ans;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3756kb

input:

2
.?
?#

output:

4

result:

ok 1 number(s): "4"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

3
#??
#??
?##

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

3
.#.
#?#
.#.

output:

0

result:

ok 1 number(s): "0"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

1
.

output:

1

result:

ok 1 number(s): "1"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

1
#

output:

1

result:

ok 1 number(s): "1"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

1
?

output:

4

result:

ok 1 number(s): "4"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

2
?.
?.

output:

12

result:

ok 1 number(s): "12"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

3
?.?
.#?
?.?

output:

256

result:

ok 1 number(s): "256"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

5
?????
.?.#.
???#?
?##??
?.?.?

output:

12288

result:

ok 1 number(s): "12288"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

10
...###???.
?.???.??#.
??.?????..
.#..?.????
???...?..?
.???.?..??
??.????.??
.????.?.??
#.????.?#?
?.##???#??

output:

0

result:

ok 1 number(s): "0"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

10
..?.??????
.?.?.?.?..
???#????.?
??#.??.??.
?..???.?#.
.????.?.??
?...?.#???
?.?..???.?
?.?..??.??
###..#.??#

output:

453983775

result:

ok 1 number(s): "453983775"

Test #12:

score: -100
Runtime Error

input:

100
.........?...........................................?...?.....?...................#??..??......?...
......?....................................?...?..?...?...?..??......?...?#......?............?.?.?.
.....??........??............?........?..............?...?..?.............................?......

output:


result: