結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー Manuel1024
提出日時 2021-04-17 02:54:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 501 bytes
コンパイル時間 587 ms
コンパイル使用メモリ 70,896 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-14 19:42:02
合計ジャッジ時間 15,305 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
using ll = long long int;

int main(){
    int t;
    cin >> t;
    while(t--){
        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+10; i++){
            if(a[i%n] == b[i%m]){
                ans = i+1;
                break;
            }
        }
        cout << ans << endl;
    }
    return 0;
}
0