結果
| 問題 |
No.515 典型LCP
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-05 23:39:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
OLE
|
| 実行時間 | - |
| コード長 | 864 bytes |
| コンパイル時間 | 1,705 ms |
| コンパイル使用メモリ | 169,224 KB |
| 実行使用メモリ | 11,904 KB |
| 最終ジャッジ日時 | 2024-09-14 09:19:27 |
| 合計ジャッジ時間 | 6,616 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | OLE * 1 -- * 14 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
}
int m, x, d;
cin >> m >> x >> d;
int sum = 0;
for (int k = 1; k <= m; k++) {
int i, j;
i = (x / (n - 1));
j = (x % (n - 1));
if (i > j) {
swap(i, j);
} else {
j++;
}
x = (x + d) % (n * (n - 1));
cout << "i: " << i << " j: " << j << " x: " << x << endl;
cout << s[i].length() << " " << s[j].length() << endl;
int len = min(s[i].length(), s[j].length());
for (int l = 0; l < len; l++) {
if (s[i][l] == s[j][l]) {
sum++;
} else {
break;
}
}
}
cout << sum << endl;
return 0;
}