結果
| 問題 |
No.2268 NGワード回避
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-14 21:52:14 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 2,000 ms |
| コード長 | 604 bytes |
| コンパイル時間 | 1,480 ms |
| コンパイル使用メモリ | 177,660 KB |
| 実行使用メモリ | 6,656 KB |
| 最終ジャッジ日時 | 2024-06-23 03:37:42 |
| 合計ジャッジ時間 | 3,356 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 52 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
int main() {
int N; cin >> N;
vector<string> A(N);
for(int i = 0; i < N; i++) cin >> A[i];
string ans = "";
map<string,int> dic;
for(int j = 0; j < N; j++) {
int a = 0;
int b = 0;
for(int i = 0; i < N; i++) {
if(A[i][j] == 'a') {
a++;
}else {
b++;
}
}
if(a >= b) {
ans += 'b';
}else {
ans += 'a';
}
dic[A[j]]++;
}
if(dic[ans] > 0) {
cout << "aba" << endl;
return 0;
}
cout << ans << endl;
}