結果
| 問題 |
No.2000 Distanced Characters
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2022-07-08 22:18:45 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 2,000 ms |
| コード長 | 697 bytes |
| コンパイル時間 | 2,176 ms |
| コンパイル使用メモリ | 194,180 KB |
| 最終ジャッジ日時 | 2025-01-30 05:24:04 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 13 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int D[26][26];
int A[26][26];
const int INF=1e9;
int B[26];
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
string s;
cin>>s;
int n=s.size();
rep(i,26) rep(j,26){
cin>>D[i][j];
A[i][j]=INF;
}
rep(i,26) B[i]=-1;
rep(i,n){
int a=s[i]-'a';
rep(j,26){
if(B[j]==-1) continue;
A[j][a]=min(A[j][a],i-B[j]);
}
B[a]=i;
}
rep(i,26){
rep(j,26){
if(j) cout<<" ";
if(D[i][j]<=A[i][j]) cout<<'Y';
else cout<<'N';
}
cout<<endl;
}
return 0;
}
umezo