結果

問題 No.2000 Distanced Characters
ユーザー Rubikun
提出日時 2022-07-08 21:22:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,235 bytes
コンパイル時間 2,385 ms
コンパイル使用メモリ 199,900 KB
最終ジャッジ日時 2025-01-30 05:15:47
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other AC * 3 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=1005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S;cin>>S;
    vector<vector<int>> pos(26);
    for(int i=0;i<si(S);i++){
        pos[S[i]-'a'].push_back(i);
    }
    vector<vector<int>> A(26,vector<int>(26));
    for(int i=0;i<26;i++){
        for(int j=0;j<26;j++){
            cin>>A[i][j];
        }
    }
    
    for(int i=0;i<26;i++){
        for(int j=0;j<26;j++){
            if(si(pos[i])==0||si(pos[j])==0){
                cout<<"Y ";
            }else{
                int a=pos[i].back(),b=pos[j].front();
                if(a+A[i][j]>b){
                    cout<<"N ";
                }else{
                    cout<<"Y ";
                }
            }
        }
        cout<<"\n";
    }
}
0