結果

問題 No.1544 [Cherry 2nd Tune C] Synchroscope
ユーザー OmameBeansOmameBeans
提出日時 2021-07-06 20:28:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 1,190 bytes
コンパイル時間 1,541 ms
コンパイル使用メモリ 168,608 KB
実行使用メモリ 300,564 KB
最終ジャッジ日時 2023-09-14 04:27:56
合計ジャッジ時間 10,538 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 69 ms
91,372 KB
testcase_04 AC 131 ms
171,644 KB
testcase_05 AC 92 ms
111,016 KB
testcase_06 AC 128 ms
156,160 KB
testcase_07 AC 106 ms
132,172 KB
testcase_08 AC 77 ms
110,756 KB
testcase_09 AC 14 ms
15,312 KB
testcase_10 AC 124 ms
158,660 KB
testcase_11 AC 64 ms
76,620 KB
testcase_12 AC 59 ms
73,340 KB
testcase_13 AC 15 ms
12,400 KB
testcase_14 AC 161 ms
191,088 KB
testcase_15 AC 176 ms
189,784 KB
testcase_16 AC 56 ms
65,252 KB
testcase_17 AC 40 ms
47,636 KB
testcase_18 AC 12 ms
11,556 KB
testcase_19 AC 19 ms
19,580 KB
testcase_20 AC 152 ms
165,700 KB
testcase_21 AC 31 ms
36,072 KB
testcase_22 AC 17 ms
16,100 KB
testcase_23 AC 268 ms
262,288 KB
testcase_24 AC 260 ms
262,204 KB
testcase_25 AC 259 ms
262,404 KB
testcase_26 AC 260 ms
261,148 KB
testcase_27 AC 261 ms
261,252 KB
testcase_28 AC 260 ms
261,668 KB
testcase_29 AC 259 ms
261,452 KB
testcase_30 AC 262 ms
262,332 KB
testcase_31 AC 261 ms
261,480 KB
testcase_32 AC 267 ms
261,068 KB
testcase_33 AC 282 ms
260,832 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 3 ms
4,376 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 286 ms
300,564 KB
testcase_39 AC 282 ms
260,884 KB
testcase_40 AC 281 ms
282,332 KB
testcase_41 AC 284 ms
261,588 KB
testcase_42 AC 276 ms
278,092 KB
testcase_43 AC 266 ms
288,660 KB
testcase_44 AC 270 ms
291,512 KB
testcase_45 AC 278 ms
279,344 KB
testcase_46 AC 277 ms
292,444 KB
testcase_47 AC 275 ms
278,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i = 0; i < (n); ++i)
#define DREP(i,s,n) for(int i = (s); i < (n); i++)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const int MOD = 1000000007;
const double pi = acos(-1);
ll gcd(ll a, ll b) {if(b == 0) return a; else return gcd(b,a%b);}
ll lcm(ll a, ll b) {return a*b/gcd(a,b);}

void ex_gcd(ll a, ll b, ll &x, ll &y) {
    if(b == 0) {
        x = 1, y = 0;
        return;
    }
    ex_gcd(b,a%b,y,x);
    y -= (a/b)*x;
}

int main() {
    int N,M; cin >> N >> M;
    veci A(N),B(M);
    REP(i,N) cin >> A[i];
    REP(i,M) cin >> B[i];
    REP(i,M-1) REP(j,N) A.push_back(A[j]);
    REP(i,N-1) REP(j,M) B.push_back(B[j]);
    REP(i,N*M) if(A[i] == B[i]) {
        cout << i+1 << endl;
        return 0;
    }
    cout << -1 << endl;
    return 0;
}
0