提出 #75729602


ソースコード 拡げる

#include <bits/stdc++.h>
#define fastio cin.tie(0)->sync_with_stdio(0)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define compress(v) sort(all(v)), v.erase(unique(all(v)), v.end())
#define sz(x) (int)(x).size()
using namespace std;
typedef long long ll;

int main() {
    fastio; int T; cin >> T;
    for (int tc = 0; tc < T; tc++) {
        int H, W; cin >> H >> W;
        vector<string> sv(2*H);
        for (auto &i : sv) cin >> i;
        vector<pair<int,int>> v;
        for (int i = 0; i < 2*H; i++) {
            for (int j = 1; j < 2*W; j++) {
                if (i%2 == 0) v.push_back({ i, j });
                else v.push_back({ i, 2*W-j });
            }
        }
        for (int i = 2*H-1; i >= 0; i--) v.push_back({ i, 0 });
        int c = 0;
        for (int i = 0; i < 2*H*W; i++) {
            if (sv[v[i].first][v[i].second] == 'o') c++;
        }
        auto solve = [&]() {
            if (c == H*W) return 0;
            for (int i = 2*H*W; i < 4*H*W; i++) {
                if (sv[v[i-2*H*W].first][v[i-2*H*W].second] == 'o') c--;
                if (sv[v[i].first][v[i].second] == 'o') c++;
                if (c == W*H) return i-2*H*W+1;
            }
        };
        int t = solve();
        vector<vector<bool>> ans(2*H, vector<bool>(2*W));
        for (int i = t; i < t+2*H*W; i++) {
            ans[v[i].first][v[i].second] = 1;
        }
        for (auto i : ans) {
            for (auto j : i) {
                cout << (j ? "A" : "B");
            }
            cout << "\n";
        }
    }
    return 0;
}

提出情報

提出日時
問題 E - Equal Distribution
ユーザ Lov34ever
言語 C++23 (GCC 15.2.0)
得点 600
コード長 1629 Byte
結果 AC
実行時間 99 ms
メモリ 42116 KiB

コンパイルエラー

./Main.cpp: In lambda function:
./Main.cpp:35:9: warning: control reaches end of non-void function [-Wreturn-type]
   35 |         };
      |         ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 600 / 600
結果
AC × 1
AC × 32
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt, 02_random_20.txt, 02_random_21.txt, 02_random_22.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 3 ms 3524 KiB
01_handmade_00.txt AC 11 ms 3652 KiB
01_handmade_01.txt AC 98 ms 40716 KiB
01_handmade_02.txt AC 94 ms 40716 KiB
01_handmade_03.txt AC 94 ms 40720 KiB
01_handmade_04.txt AC 91 ms 4516 KiB
01_handmade_05.txt AC 95 ms 4524 KiB
01_handmade_06.txt AC 92 ms 4524 KiB
01_handmade_07.txt AC 95 ms 4520 KiB
02_random_00.txt AC 83 ms 4520 KiB
02_random_01.txt AC 73 ms 4524 KiB
02_random_02.txt AC 88 ms 5144 KiB
02_random_03.txt AC 91 ms 8496 KiB
02_random_04.txt AC 90 ms 4872 KiB
02_random_05.txt AC 97 ms 42012 KiB
02_random_06.txt AC 96 ms 40712 KiB
02_random_07.txt AC 99 ms 40708 KiB
02_random_08.txt AC 97 ms 40708 KiB
02_random_09.txt AC 97 ms 40716 KiB
02_random_10.txt AC 99 ms 40716 KiB
02_random_11.txt AC 98 ms 40712 KiB
02_random_12.txt AC 98 ms 40708 KiB
02_random_13.txt AC 97 ms 40712 KiB
02_random_14.txt AC 97 ms 40712 KiB
02_random_15.txt AC 74 ms 4512 KiB
02_random_16.txt AC 86 ms 5056 KiB
02_random_17.txt AC 91 ms 8492 KiB
02_random_18.txt AC 95 ms 39472 KiB
02_random_19.txt AC 95 ms 42108 KiB
02_random_20.txt AC 90 ms 8496 KiB
02_random_21.txt AC 94 ms 39476 KiB
02_random_22.txt AC 96 ms 42116 KiB