結果
| 問題 | No.3750 Mischievous Resident (Easy) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-02 22:17:06 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 35 ms / 2,000 ms |
| + 329µs | |
| コード長 | 809 bytes |
| 記録 | |
| コンパイル時間 | 2,762 ms |
| コンパイル使用メモリ | 339,784 KB |
| 実行使用メモリ | 9,924 KB |
| 最終ジャッジ日時 | 2026-10-02 22:17:14 |
| 合計ジャッジ時間 | 7,003 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge4_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 35 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int Q;
cin >> Q;
while(Q--){
int n, m;
cin >> n >> m;
vector<pair<int,int>> a(m);
for(int i = 0; i < m; i++) cin >> a[i].first;
for(int i = 0; i < m; i++) cin >> a[i].second;
sort(a.begin(), a.end());
bool flg = true;
for(int i = 0; i + 1 < m; i++){
if(a[i].second > a[i + 1].second){
flg = false;
break;
}
if(a[i].second == a[i + 1].second && (a[i].first != a[i + 1].first || a[i].first != a[i].second)){
flg = false;
break;
}
}
cout << (flg ? "Yes" : "No") << "\n";
}
}