結果

問題 No.290 1010
コンテスト
ユーザー zaichu
提出日時 2016-01-01 22:37:02
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 5,000 ms
+ 323µs
コード長 553 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 812 ms
コンパイル使用メモリ 179,576 KB
実行使用メモリ 9,776 KB
最終ジャッジ日時 2026-08-30 23:24:50
合計ジャッジ時間 2,421 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

int main(){
	long long  n;
	cin >> n;
	if(n >= 4){
		cout << "YES" << endl;
		return 0;
	}
	n++;
	string str,s = " ";
	cin >> str;
	s += str;
	long long i,j;
	for(i = 1; i < n; i++){
		string str1 = "", str2 = "";;
		for(j = i; j + (j + 1 - i) <= n; j++){
			str1 += s[j];
			str2 += s[j+1];
			//			cout << i << " " << j << endl;
			//			cout << "str1 = " << str1 << " str2 = " << str2 << endl;
			if(str1 == str2){
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
	return 0;
}
0