結果
| 問題 |
No.1544 [Cherry 2nd Tune C] Synchroscope
|
| コンテスト | |
| ユーザー |
momoyuu
|
| 提出日時 | 2024-10-06 23:14:55 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 160 ms / 2,000 ms |
| コード長 | 495 bytes |
| コンパイル時間 | 1,152 ms |
| コンパイル使用メモリ | 94,548 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-06 23:15:00 |
| 合計ジャッジ時間 | 4,348 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 48 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
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];
for(int i = 0;i<n*m;i++){
int ni = i % n;
int nj = i % m;
if(a[ni]==b[nj]){
cout<<i+1<<endl;
return 0;
}
}
cout<<-1<<endl;
}
momoyuu