QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#673767#5270. Easily Distinguishable TrianglesIllusionaryDominance#WA 0ms3648kbC++20973b2024-10-25 09:59:292024-10-25 09:59:31

Judging History

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

  • [2024-10-25 09:59:31]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3648kb
  • [2024-10-25 09:59:29]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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'