結果
問題 | No.1544 [Cherry 2nd Tune C] Synchroscope |
ユーザー |
![]() |
提出日時 | 2021-05-19 02:15:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 156 ms / 2,000 ms |
コード長 | 400 bytes |
コンパイル時間 | 1,015 ms |
コンパイル使用メモリ | 68,884 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-14 21:33:12 |
合計ジャッジ時間 | 3,954 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 48 |
ソースコード
#include <iostream>#include <vector>using namespace std;using ll = long long int;int main(){int n, m;cin >> n >> m;vector<int> a(n), b(m);for(auto &p: a) cin >> p;for(auto &p: b) cin >> p;int ans = -1;for(int i = 0; i < n*m; i++){if(a[i%n] == b[i%m]){ans = i+1;break;}}cout << ans << endl;return 0;}