結果

問題 No.3750 Mischievous Resident (Easy)
コンテスト
ユーザー GOTKAKO
提出日時 2026-10-02 21:38:44
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 93 ms / 2,000 ms
+ 63µs
コード長 725 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,218 ms
コンパイル使用メモリ 229,748 KB
実行使用メモリ 14,464 KB
最終ジャッジ日時 2026-10-02 21:38:53
合計ジャッジ時間 7,312 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int T; cin >> T;
    while(T--){
        int N,M; cin >> N >> M;
        vector<tuple<int,int>> S(M);
        map<int,int> Ts;
        for(int i=0; i<M; i++){
            int a; cin >> a;
            S.at(i) = {-1,a};
        }
        for(auto &[t,s] : S) cin >> t,Ts[t]++;
        sort(S.begin(),S.end());
        int ng = 0;
        for(int i=1; i<M; i++){
            auto [t,s] = S.at(i-1);
            auto [t2,s2] = S.at(i);
            if(s > s2) ng = 1;
            if(t == t2 && (s != t || s2 != t2)) ng = 1;
        }
        if(ng) cout << "No\n";
        else cout << "Yes\n";
    }
}
0