提出 #73131583


ソースコード 拡げる

#include <bits/stdc++.h>
#define rep(i, s, e) for (ll i = (ll)(s); i < (ll)(e); ++i)
#define rrep(i, s ,e) for (ll i = (ll)(s); i > (ll)(e); --i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 998244353;
//const ll MOD = 1000000007;


int main(){
    cin.tie(0);cout.tie(0);
    ios_base::sync_with_stdio(false);

    ll n;cin >> n;
    vector<vector<char>> s(n,vector<char>(n));
    rep(i,0,n)rep(j,0,n)cin >> s[i][j];
    rep(i,0,2*n){
        bool b = 0;
        char C = '^';
        rep(j,0,i+1){
            ll x = j,y = i-j;
            if(x < 0 || y < 0 || x >= n || y >= n)continue;
            if(s[x][y] == '?'){
                b = 1;
            }
            else{
                if(C == '^')C = s[x][y];
                else{
                    if(C != s[x][y]){
                        cout << -1 << endl;
                        return 0;
                    }
                }
            }
        }
        if(C == '^')C = '0';
        rep(j,0,i+1){
             ll x = j,y = i-j;
               if(x < 0 || y < 0 || x >= n || y >= n)continue;
             s[x][y] = C;
        }
    }
    rep(i,0,n){
        rep(j,0,n)cout << s[i][j];
        cout << endl;
    }
}

提出情報

提出日時
問題 A - Same Sum Grid Path
ユーザ KH8047
言語 C++23 (GCC 15.2.0)
得点 300
コード長 1275 Byte
結果 AC
実行時間 1 ms
メモリ 3756 KiB

コンパイルエラー

./Main.cpp: In function 'int main()':
./Main.cpp:19:14: warning: variable 'b' set but not used [-Wunused-but-set-variable]
   19 |         bool b = 0;
      |              ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 16
セット名 テストケース
Sample sample-01.txt, sample-02.txt, sample-03.txt
All 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, sample-01.txt, sample-02.txt, sample-03.txt
ケース名 結果 実行時間 メモリ
01-01.txt AC 1 ms 3628 KiB
01-02.txt AC 1 ms 3728 KiB
01-03.txt AC 1 ms 3400 KiB
01-04.txt AC 1 ms 3588 KiB
01-05.txt AC 1 ms 3752 KiB
01-06.txt AC 1 ms 3688 KiB
01-07.txt AC 1 ms 3528 KiB
01-08.txt AC 1 ms 3724 KiB
01-09.txt AC 1 ms 3584 KiB
01-10.txt AC 1 ms 3724 KiB
01-11.txt AC 1 ms 3628 KiB
01-12.txt AC 1 ms 3756 KiB
01-13.txt AC 1 ms 3688 KiB
sample-01.txt AC 1 ms 3628 KiB
sample-02.txt AC 1 ms 3628 KiB
sample-03.txt AC 1 ms 3528 KiB