結果
| 問題 |
No.2000 Distanced Characters
|
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2024-02-21 00:17:36 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 19 ms / 2,000 ms |
| コード長 | 758 bytes |
| コンパイル時間 | 2,018 ms |
| コンパイル使用メモリ | 197,500 KB |
| 最終ジャッジ日時 | 2025-02-19 18:12:57 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "settings/debug.cpp"
#define _GLIBCXX_DEBUG
#else
#define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
int main() {
string s;
cin >> s;
constexpr int ws = 26;
vector a(ws, vector<int>(ws));
rep(i, ws) rep(j, ws) cin >> a[i][j];
vector dist(ws, vector<int>(ws, 1e9));
vector<int> lastseen(ws, -1);
rep(i, s.size()) {
rep(j, ws) {
if (lastseen[j] != -1) dist[j][s[i] - 'a'] = min(dist[j][s[i] - 'a'], i - lastseen[j]);
}
lastseen[s[i] - 'a'] = i;
}
rep(i, ws) {
rep(j, ws) cout << (dist[i][j] >= a[i][j] ? 'Y' : 'N') << " ";
cout << endl;
}
return 0;
}
a01sa01to