結果

問題 No.2254 Reverse Only
ユーザー lddlinanlddlinan
提出日時 2023-03-24 23:07:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,141 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 93,008 KB
実行使用メモリ 10,668 KB
最終ジャッジ日時 2023-10-18 21:28:32
合計ジャッジ時間 7,195 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 231 ms
10,604 KB
testcase_09 WA -
testcase_10 AC 50 ms
4,684 KB
testcase_11 AC 236 ms
10,604 KB
testcase_12 AC 129 ms
10,612 KB
testcase_13 AC 230 ms
10,596 KB
testcase_14 AC 233 ms
10,620 KB
testcase_15 WA -
testcase_16 AC 231 ms
10,612 KB
testcase_17 AC 234 ms
10,612 KB
testcase_18 AC 210 ms
10,628 KB
testcase_19 AC 73 ms
4,692 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 48 ms
4,684 KB
testcase_25 AC 50 ms
4,684 KB
testcase_26 AC 50 ms
4,684 KB
testcase_27 AC 6 ms
4,348 KB
testcase_28 AC 38 ms
5,268 KB
testcase_29 AC 93 ms
7,312 KB
testcase_30 AC 79 ms
6,860 KB
testcase_31 AC 40 ms
5,392 KB
testcase_32 AC 46 ms
5,668 KB
testcase_33 AC 20 ms
4,368 KB
testcase_34 AC 126 ms
8,252 KB
testcase_35 AC 72 ms
6,696 KB
testcase_36 AC 198 ms
9,804 KB
testcase_37 AC 207 ms
10,012 KB
testcase_38 AC 31 ms
4,944 KB
testcase_39 AC 177 ms
9,448 KB
testcase_40 AC 6 ms
4,348 KB
testcase_41 AC 64 ms
6,400 KB
testcase_42 AC 34 ms
5,100 KB
testcase_43 AC 135 ms
8,552 KB
testcase_44 AC 223 ms
10,304 KB
testcase_45 AC 125 ms
8,148 KB
testcase_46 AC 5 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <map>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <algorithm>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <string>
using namespace std;

bool rcmp(int a, int b) { return a>b; }
typedef long long LL;
class mypcmp {
public:
    bool operator()(const int& a, const int& b) {
        return a<b;
    }
};



int as[200004];
int bs[200004];
int main() {
    int n, i, k, v;
    scanf("%d %d", &n, &k);
    for (i=0; i<n; i++) scanf("%d", &as[i]);
    for (i=0; i<n; i++) scanf("%d", &bs[i]);
    map<int, int> cs;
    for (i=0; i<n; i++) cs[as[i]]++;
    for (i=0; i<n; i++) {
        v=bs[i];
        if (cs[v]==0) break;
        cs[v]--;
    }
    if(i<n) printf("No\n");
    else {
        for (i=0; i<n; i++) {
            if (i+1>=k||n-i>=k) continue;
            if (as[i]==bs[i]) continue;
            if (k-(i+1)+k<=n) continue;
            if (k-(n-i)+k<=n) continue;
            if (k>=n) break;
        }
        if(i<n) printf("No\n");
        else printf("Yes\n");
    }
    return 0;
}
0