結果

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

ソースコード

diff #

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

int main(){
    int t;
    cin >> t;
    assert(1 <= t <= 5);
    while(t--){
        int n, m;
        cin >> n >> m;
        assert(1 <= n <= 5000);
        assert(1 <= m <= 5000);
        vector<int> a(n), b(m);
        for(auto &p: a){
            cin >> p;
            assert(1 <= p <= 10000);
        }
        for(auto &p: b){
            cin >> p;
            assert(1 <= p <= 10000);
        }
        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