結果

問題 No.3750 Mischievous Resident (Easy)
コンテスト
ユーザー shingo0909
提出日時 2026-10-02 21:31:54
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,248 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,407 ms
コンパイル使用メモリ 349,424 KB
実行使用メモリ 9,920 KB
最終ジャッジ日時 2026-10-02 21:32:06
合計ジャッジ時間 8,394 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 23 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// https://github.com/shingo0909/kyopro/blob/39029fab39c1735c38e5e9e4494d9934f81d6918/Library/compress.cpp

template <typename... Vectors>
auto compress(Vectors... vecs) {
    vector<int> b;
    (b.insert(b.end(), vecs.begin(), vecs.end()), ...);
    sort(b.begin(), b.end());
    // b.erase(unique(b.begin(), b.end()), b.end());

    auto enc = [&](vector<int> a) {
        vector<int> res(a.size());
        for (int i = 0; i < (int)a.size(); i++) {
            res[i] = lower_bound(b.begin(), b.end(), a[i]) - b.begin();
        }
        return res;
    };

    return make_tuple(enc(vecs)...);
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int t;
    cin >> t;
    while (t--) {
        int n, m;
        cin >> n >> m;
        vector<int> s(m);
        vector<int> g(m);
        rep(i, m) cin >> s[i];
        rep(i, m) cin >> g[i];
        tie(s) = compress(s);
        tie(g) = compress(g);
        bool ok = true;
        rep(i, m) {
            if (s[i] > g[i]) {
                ok = false;
            }
        }
        cout << (ok ? "Yes" : "No") << endl;
    }
    return 0;
}
0