結果

問題 No.2254 Reverse Only
ユーザー lddlinanlddlinan
提出日時 2023-03-24 23:02:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,131 bytes
コンパイル時間 792 ms
コンパイル使用メモリ 92,640 KB
実行使用メモリ 10,684 KB
最終ジャッジ日時 2023-10-18 21:26:24
合計ジャッジ時間 6,762 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 WA -
testcase_09 AC 215 ms
10,656 KB
testcase_10 AC 50 ms
4,732 KB
testcase_11 AC 221 ms
10,652 KB
testcase_12 AC 124 ms
10,660 KB
testcase_13 AC 213 ms
10,644 KB
testcase_14 AC 219 ms
10,668 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 198 ms
10,676 KB
testcase_19 WA -
testcase_20 AC 73 ms
4,740 KB
testcase_21 AC 73 ms
4,740 KB
testcase_22 AC 37 ms
4,732 KB
testcase_23 AC 49 ms
4,732 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 5 ms
4,348 KB
testcase_28 AC 37 ms
5,316 KB
testcase_29 AC 87 ms
7,360 KB
testcase_30 WA -
testcase_31 AC 40 ms
5,440 KB
testcase_32 AC 46 ms
5,716 KB
testcase_33 AC 19 ms
4,416 KB
testcase_34 AC 122 ms
8,300 KB
testcase_35 AC 71 ms
6,744 KB
testcase_36 AC 178 ms
9,852 KB
testcase_37 AC 186 ms
10,060 KB
testcase_38 AC 30 ms
4,992 KB
testcase_39 WA -
testcase_40 AC 5 ms
4,348 KB
testcase_41 AC 63 ms
6,448 KB
testcase_42 AC 33 ms
5,148 KB
testcase_43 AC 128 ms
8,600 KB
testcase_44 AC 196 ms
10,352 KB
testcase_45 WA -
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;
            break;
        }
        if(i<n) printf("No\n");
        else printf("Yes\n");
    }
    return 0;
}
0