QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#770018#9627. 算术proven#WA 0ms3528kbC++202.7kb2024-11-21 20:17:332024-11-21 20:17:36

Judging History

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

  • [2024-11-21 20:17:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3528kb
  • [2024-11-21 20:17:33]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
#define endl '\n'
#define int long long
const int mod = 998244353;

void solve() {
    int n; cin >> n;
    string a, b;
    cin >> a >> b;
    vector<vector<int> > ans(8, vector<int> (n + 1));
    a = ' ' + a;
    b = ' ' + b;
    int fg = 0, res = 0;
    for(int i = 1;i <= n;i++) {
        if(a[i] == '.' && b[i] == '.') fg = 1, res = i;
    }
    int x = 0, y = 0;
    for(int i = 1;i <= n;i++) {
        x += (a[i] == '#');
        y += (b[i] == '#');
    }
    if(max(x, y) == n && min(x, y) != n) {
        cout << "NO" << endl;
        return;
    }
    for(int i = 1;i <= n;i++) {
        if(a[i] == '#') ans[1][i] = 1;
        if(b[i] == '#') ans[7][i] = 1;
    }
    auto out = [&] () {
        for(int i = 1;i <= 7;i++) {
            for(int j = 1;j <= n;j++) {
                if(ans[i][j]) cout << '#';
                else cout << ".";
            }
            cout << endl;
        }
    };
    auto up = [&] (int id) {
        ans[2][id] = ans[3][id] = 1;
    };
    auto down = [&] (int id) {
        ans[6][id] = ans[5][id] = ans[4][id] = 1;
    };
    auto check = [&] (int id) {
        return (a[id] == '.' && b[id] == '.');
    };
    if(fg) {
        for(int i = 1;i <= n;i++) {
            if(check(i)) {
                int j = i;
                while(j + 1 <= n && !check(j + 1)) j++;
//                cout << i << "  " << j << endl;
                if(!check(j)) {
                    for(int k = i;k <= j;k++) {
                        if(a[k] == '#' && b[k] == '#') continue;
                        if(a[k] == '.') ans[2][k] = 1;
                        else ans[6][k] = 1;
                    }
                    i = j;
                }
                else {
                    for(int k = 2;k <= 6;k++) ans[k][i] = ans[k][j] = 1;
                    for(int k = i + 1;k < j;k++) {
                        if(a[k] == '#' && b[k] == '#') continue;
                        if(a[k] == '.') ans[2][k] = 1;
                        else ans[6][k] = 1;
                    }
                    i = j;
                }
            }
        }
        out();
    }
    else {
        for(int i = 1;i <= n;i++) {
            if(a[i] == '#') {
                ans[2][i] = ans[3][i] = 1;
            }
            if(b[i] == '#') {
                ans[6][i] = ans[5][i] = ans[4][i] = 1;
            }
        }
        out();
    }
}

/*
4
4
#..#
.##.
5
##.#.
.#.##
6
######
.####.
27
.######.######.####.#.#####
.####...####..#.......#####
*/
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T--) {
        solve();
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3528kb

input:

7
5 3 0 0 0 0 0 0 0
4 1 1 1 0 0 0 0 0
1 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 2
99 88 77 66 55 44 33 22 11
100 90 80 70 60 50 40 30 20

output:

...#.
...#.
...#.
.....
.....
.....
.....














...#
...#
...#
....
....
....
....
.
.
.
.
.
.
.







.
.
.
.
.
.
.

result:

wrong answer 1st lines differ - expected: '54', found: '...#.'