結果
| 問題 |
No.1544 [Cherry 2nd Tune C] Synchroscope
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-11 22:24:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 198 ms / 2,000 ms |
| コード長 | 477 bytes |
| コンパイル時間 | 1,124 ms |
| コンパイル使用メモリ | 72,060 KB |
| 最終ジャッジ日時 | 2025-01-22 06:12:21 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 48 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
void solve() {
int n, m;
cin >> n >> m;
vector<int> xs(n), ys(m);
for (auto& x : xs) cin >> x;
for (auto& y : ys) cin >> y;
for (int i = 0; i < n * m; ++i) {
if (xs[i % n] == ys[i % m]) {
cout << i + 1 << "\n";
return;
}
}
cout << "-1\n";
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
solve();
return 0;
}