結果

問題 No.3061 uxs hxixtya pyuyn ixc hyixa kxuyn
ユーザー TlapesiumTlapesium
提出日時 2020-04-01 22:15:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,343 bytes
コンパイル時間 3,213 ms
コンパイル使用メモリ 220,948 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-09-09 18:36:55
合計ジャッジ時間 7,148 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,756 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 6 ms
4,380 KB
testcase_05 AC 52 ms
4,380 KB
testcase_06 AC 18 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 13 ms
4,376 KB
testcase_10 AC 5 ms
4,380 KB
testcase_11 AC 10 ms
4,376 KB
testcase_12 AC 6 ms
4,380 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")
#define io_init cin.tie(0);ios::sync_with_stdio(0);cout<<setprecision(10)
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//abcde
int main() {
	//io_init;
	string S;
	getline(cin, S);
	if (S.size() == 1) {
		cout << "NO" << endl;
		return 0;
	}
	else if (S.size() == 2) {
		if (S[0] == S[1]) {
			cout << "NO" << endl;
		}
		else {
			cout << "Yes" << endl;
		}
		return 0;
	}
	bool flag = false;
	for (int i = 0; i <= S.size() - 2; i++) {
		for (int j = i + 2; j <= S.size(); j++) {
			string tmp = S.substr(i, j - i);
			set<char> o, e;
			for (int k = 0; k < tmp.size(); k++) {
				if (k % 2 == 0)o.insert(tmp[k]);
				else e.insert(tmp[k]);
			}
			for (int k = 0; k < i; k++) {
				e.insert(S[k]);
			}
			for (int k = j; k < S.size(); k++) {
				e.insert(S[k]);
			}
			
			bool flag2 = false;
			for (auto itr = o.begin(); itr != o.end(); itr++) {
				if (e.count(*itr) == 1)flag2 = true;
			}
			if (!flag2) flag = true;
		}
	}
	
	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}
0