結果

問題 No.2000 Distanced Characters
ユーザー ぷらぷら
提出日時 2022-07-08 21:24:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 722 bytes
コンパイル時間 2,223 ms
コンパイル使用メモリ 203,000 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-27 20:45:43
合計ジャッジ時間 3,016 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 12 ms
4,380 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    string S;
    cin >> S;
    vector<vector<int>>D(26,vector<int>(26));
    for(int i = 0; i < 26; i++) {
        for(int j = 0; j < 26; j++) {
            cin >> D[i][j];
        }
    }
    vector<vector<int>>F(26,vector<int>(26));
    vector<int>mx(26,-1);
    for(int i = 0; i < S.size(); i++) {
        mx[S[i]-'a'] = max(mx[S[i]-'a'],i);
        for(int j = 0; j < 26; j++) {
            if(mx[j] != -1 && mx[j]+D[j][S[i]-'a'] > i) {
                F[j][S[i]-'a'] = 1;
            }
        }
    }
    for(int i = 0; i < 26; i++) {
        for(int j = 0; j < 26; j++) {
            cout << ((F[i][j])?"N":"Y") << ((j == 25)?"\n":" ");
        }
    }
}
0