結果

問題 No.2000 Distanced Characters
ユーザー CleyLCleyL
提出日時 2022-08-18 16:00:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 752 bytes
コンパイル時間 794 ms
コンパイル使用メモリ 79,444 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 00:24:22
合計ジャッジ時間 1,921 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 11 ms
5,376 KB
testcase_09 AC 15 ms
5,376 KB
testcase_10 AC 16 ms
5,376 KB
testcase_11 AC 13 ms
5,376 KB
testcase_12 AC 10 ms
5,376 KB
testcase_13 AC 9 ms
5,376 KB
testcase_14 AC 9 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main(){
    string s;cin>>s;
    vector<int> A(26);
    vector<vector<int>> table(26,vector<int>(26,200010));
    for(int i = 0; s.size() > i; i++){
        for(int j = 0; 26 > j; j++){
            if(A[j]){
                table[j][s[i]-'a'] = min(i+1-A[j], table[j][s[i]-'a']);
            }
        }
        A[s[i]-'a'] = i+1;
    }
    vector<vector<int>> x(26,vector<int>(26));
    for(int i = 0; 26 > i; i++){
        for(int j = 0; 26 > j; j++){
            cin>>x[i][j];
            if(x[i][j] > table[i][j]){
                cout << "N";
            }else{
                cout << "Y";
            }
            if(j+1 != 26)cout << " ";
        }
        cout << endl;
    }
}
0