結果
| 問題 |
No.2000 Distanced Characters
|
| コンテスト | |
| ユーザー |
遭難者
|
| 提出日時 | 2022-06-25 23:37:43 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 1,037 bytes |
| コンパイル時間 | 18,710 ms |
| コンパイル使用メモリ | 240,284 KB |
| 最終ジャッジ日時 | 2025-01-30 00:51:58 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 13 |
ソースコード
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
using namespace std;
using ll = long long;
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
#define rep(i, n) for (int i = 0; i < n; i++)
#define endl '\n'
#define ALL(a) (a).begin(), (a).end()
int d[26][26];
bool a[26][26];
int t[26];
int main()
{
string s;
cin >> s;
rep(i, 26) rep(j, 26) cin >> d[i][j], a[i][j] = true;
rep(i, 26) t[i] = -1e9;
const int n = s.length();
rep(j, n)
{
const int c = s[j] - 'a';
rep(i, 26) a[i][c] &= t[i] + d[i][c] <= j;
t[c] = j;
}
rep(i, 26)
{
rep(j, 25) cout << (a[i][j] ? 'Y' : 'N') << " ";
cout << (a[i][25] ? 'Y' : 'N') << endl;
}
return 0;
}
遭難者