結果

問題 No.515 典型LCP
ユーザー WA_TLEWA_TLE
提出日時 2017-05-05 23:09:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 706 bytes
コンパイル時間 596 ms
コンパイル使用メモリ 76,072 KB
実行使用メモリ 10,700 KB
最終ジャッジ日時 2023-10-12 10:16:10
合計ジャッジ時間 8,082 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
10,700 KB
testcase_01 AC 180 ms
6,252 KB
testcase_02 TLE -
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,356 KB
testcase_05 AC 82 ms
4,372 KB
testcase_06 AC 81 ms
4,372 KB
testcase_07 AC 82 ms
4,376 KB
testcase_08 AC 86 ms
4,476 KB
testcase_09 AC 898 ms
4,804 KB
testcase_10 AC 345 ms
4,784 KB
testcase_11 AC 430 ms
4,948 KB
testcase_12 AC 431 ms
5,036 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<string>
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
typedef long long int llint;
#define pub push_back
#define mp make_pair
#define fir first
#define sec second
const int big=((llint)1<<30);
const llint mod=1000000007;
//aabbaabb

//
int main(void){
	llint x,y,n,i,q,m,d,k,qx,qy,ans=0;
	vector<string> a;
	cin>>n;
	a.resize(n);
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	cin>>m>>x>>d;
	for(k=1;k<=m;k++){
		qx=(x/(n-1));
		qy=(x%(n-1));
		if(qx>qy){swap(qx,qy);} else{qy++;}
		x=(x+d)%(n*(n-1));i=0;
		while(-1){
			if(a[qx].size()<=i||a[qx].size()<=i||a[qx][i]!=a[qy][i]){break;}
			ans++;i++;
		}
	}
	cout<<ans<<endl;
	return 0;
}
0