結果
問題 | No.515 典型LCP |
ユーザー | WA_TLE |
提出日時 | 2017-05-05 23:31:14 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 405 ms / 1,000 ms |
コード長 | 1,010 bytes |
コンパイル時間 | 723 ms |
コンパイル使用メモリ | 74,852 KB |
実行使用メモリ | 16,224 KB |
最終ジャッジ日時 | 2023-10-12 11:09:12 |
合計ジャッジ時間 | 6,440 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 379 ms
16,184 KB |
testcase_01 | AC | 380 ms
16,224 KB |
testcase_02 | AC | 346 ms
10,412 KB |
testcase_03 | AC | 2 ms
4,368 KB |
testcase_04 | AC | 2 ms
4,372 KB |
testcase_05 | AC | 336 ms
10,396 KB |
testcase_06 | AC | 389 ms
10,468 KB |
testcase_07 | AC | 321 ms
10,392 KB |
testcase_08 | AC | 396 ms
10,468 KB |
testcase_09 | AC | 322 ms
11,120 KB |
testcase_10 | AC | 138 ms
11,340 KB |
testcase_11 | AC | 133 ms
11,104 KB |
testcase_12 | AC | 133 ms
11,384 KB |
testcase_13 | AC | 383 ms
10,392 KB |
testcase_14 | AC | 26 ms
10,488 KB |
testcase_15 | AC | 317 ms
10,192 KB |
testcase_16 | AC | 405 ms
10,356 KB |
ソースコード
#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=91254389315231;//そすー const int lol=101; //aabbaabb // int main(void){ llint x,y,n,i,gen,bmax,bmin,q,j,m,d,k,qx,qy,ans=0; vector<string> a; vector<vector<llint>> rolh; cin>>n; a.resize(n); rolh.resize(n); for(i=0;i<n;i++){ cin>>a[i]; rolh[i].resize(a[i].size());gen=0; for(j=0;j<a[i].size();j++){ gen*=lol; gen+=a[i][j]; gen%=mod; rolh[i][j]=gen; } } 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));bmax=min(rolh[qx].size(),rolh[qy].size());bmin=-1; while(bmax-bmin>1){ gen=(bmax+bmin)/2; if(rolh[qx][gen]!=rolh[qy][gen]){ bmax=gen; } else{ bmin=gen; } } ans+=bmax; } cout<<ans<<endl; return 0; }