結果
| 問題 |
No.1768 The frog in the well knows the great ocean.
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2021-11-26 22:52:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 892 bytes |
| コンパイル時間 | 1,447 ms |
| コンパイル使用メモリ | 170,776 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-29 18:55:25 |
| 合計ジャッジ時間 | 4,702 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 WA * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int T;
cin >> T;
for (int i = 0; i < T; i++){
int N;
cin >> N;
vector<int> A(N);
for (int j = 0; j < N; j++){
cin >> A[j];
}
vector<int> B(N);
for (int j = 0; j < N; j++){
cin >> B[j];
}
vector<int> P;
P.push_back(B[0]);
for (int j = 1; j < N; j++){
if (B[j] != B[j - 1]){
P.push_back(B[j]);
}
}
int cnt = P.size();
bool ok = true;
int p = 0;
for (int j = 0; j < cnt; j++){
while (p < N){
if (A[p] != P[j]){
p++;
} else {
break;
}
}
p++;
}
if (p >= N){
ok = false;
}
for (int j = 0; j < N; j++){
if (A[j] > B[j]){
ok = false;
}
}
if (ok){
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
}
SSRS