結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー outlineoutline
提出日時 2021-06-11 21:33:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 319 ms / 2,000 ms
コード長 1,706 bytes
コンパイル時間 1,416 ms
コンパイル使用メモリ 140,084 KB
実行使用メモリ 404,788 KB
最終ジャッジ日時 2023-08-21 11:42:07
合計ジャッジ時間 15,788 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 317 ms
342,100 KB
testcase_01 AC 295 ms
253,356 KB
testcase_02 AC 285 ms
379,684 KB
testcase_03 AC 238 ms
311,072 KB
testcase_04 AC 264 ms
404,788 KB
testcase_05 AC 224 ms
300,040 KB
testcase_06 AC 238 ms
298,688 KB
testcase_07 AC 279 ms
367,684 KB
testcase_08 AC 251 ms
357,372 KB
testcase_09 AC 242 ms
316,732 KB
testcase_10 AC 236 ms
307,304 KB
testcase_11 AC 248 ms
270,672 KB
testcase_12 AC 241 ms
363,060 KB
testcase_13 AC 210 ms
303,292 KB
testcase_14 AC 259 ms
348,772 KB
testcase_15 AC 229 ms
312,640 KB
testcase_16 AC 285 ms
365,480 KB
testcase_17 AC 243 ms
303,040 KB
testcase_18 AC 235 ms
350,460 KB
testcase_19 AC 279 ms
368,228 KB
testcase_20 AC 260 ms
290,972 KB
testcase_21 AC 283 ms
367,812 KB
testcase_22 AC 259 ms
333,556 KB
testcase_23 AC 247 ms
282,396 KB
testcase_24 AC 245 ms
283,756 KB
testcase_25 AC 246 ms
283,144 KB
testcase_26 AC 239 ms
281,060 KB
testcase_27 AC 245 ms
282,304 KB
testcase_28 AC 241 ms
282,504 KB
testcase_29 AC 245 ms
281,992 KB
testcase_30 AC 241 ms
282,264 KB
testcase_31 AC 240 ms
282,472 KB
testcase_32 AC 238 ms
281,688 KB
testcase_33 AC 263 ms
282,444 KB
testcase_34 AC 292 ms
253,272 KB
testcase_35 AC 319 ms
253,268 KB
testcase_36 AC 285 ms
286,928 KB
testcase_37 AC 283 ms
302,236 KB
testcase_38 AC 269 ms
320,500 KB
testcase_39 AC 266 ms
281,028 KB
testcase_40 AC 259 ms
302,864 KB
testcase_41 AC 262 ms
281,396 KB
testcase_42 AC 258 ms
299,356 KB
testcase_43 AC 258 ms
315,268 KB
testcase_44 AC 260 ms
315,412 KB
testcase_45 AC 262 ms
299,528 KB
testcase_46 AC 260 ms
314,848 KB
testcase_47 AC 262 ms
298,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <array>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")

using ll = long long;
constexpr int INF = 1001001001;
// constexpr int mod = 1000000007;
constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    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];

    while(a.size() < 30000000){
        for(int i = 0; i < n; ++i)  a.emplace_back(a[i]);
    }
    while(b.size() < 30000000){
        for(int i = 0; i < m; ++i)  b.emplace_back(b[i]);
    }

    for(int i = 0; i < 30000000; ++i){
        if(a[i] == b[i]){
            cout << i + 1 << endl;
            return 0;
        }
    }

    cout << -1 << endl;

    return 0;
}
0