题目描述
blablabla
样例
blablabla
#include <iostream>
using namespace std;
#define int long long
const int N = 100010;
int a[N],b[N];
int n,m;
signed main()
{
cin >> n >> m;
for(int i = 1;i <= n;i ++) cin >> a[i];
for(int i = 1;i <= m;i ++) cin >> b[i];
int i = 1,j = 1;
while(i <= n && j <= m){
if(a[i] == b[j]) i ++,j ++;
else j ++;
}
if(i == n+1){
cout << "Yes" << endl;
}else{
cout << "No" << endl;
}
return 0;
}
算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla
算法2
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla