結果
| 問題 |
No.1544 [Cherry 2nd Tune C] Synchroscope
|
| コンテスト | |
| ユーザー |
eve__fuyuki
|
| 提出日時 | 2024-06-06 15:11:49 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 707 bytes |
| コンパイル時間 | 2,221 ms |
| コンパイル使用メモリ | 200,264 KB |
| 最終ジャッジ日時 | 2025-02-21 19:32:08 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 41 WA * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/math>
using namespace atcoder;
void fast_io() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
int main() {
fast_io();
int n, m;
cin >> n >> m;
vector<int> a(n), b(m);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < m; i++) {
cin >> b[i];
}
const int INF = 1e9;
int ans = INF;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (a[i] == b[j]) {
auto [y, z] = crt({i, j}, {n, m});
ans = min(ans, (int)y + 1);
}
}
}
cout << (ans == INF ? -1 : ans) << endl;
}
eve__fuyuki