結果

問題 No.290 1010
ユーザー Mayimg
提出日時 2018-12-05 14:43:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 618 bytes
コンパイル時間 1,672 ms
コンパイル使用メモリ 169,928 KB
実行使用メモリ 6,620 KB
最終ジャッジ日時 2024-07-19 00:53:38
合計ジャッジ時間 2,256 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	int n;
	cin >> n;
	string s;
	cin >> s;
	string t = s;
	reverse(t.begin(), t.end());
	while(s.size() > 1) {
		string a, b;
		if(s.size() % 2 == 0) {
			a = s.substr(0, s.size() / 2);
			b = s.substr(s.size() / 2);
			if(a == b) {
				cout << "YES" << endl;
				return 0;
			}
			a = t.substr(0, t.size() / 2);
			b = t.substr(t.size() / 2);
			if(a == b) {
				cout << "YES" << endl;
				return 0;
			}
		}
		s.pop_back();
		t.pop_back();
	}
	cout << "NO" << endl;
	return 0;	
}
0