arrow_forward همه ارسال‌ها

جزئیات ارسال کد#567

verified
وضعیت داوری نهایی: پاسخ نادرست تست 1
terminal
زبان برنامه‌نویسی: C++
schedule
ارسال‌کننده و زمان:
shana (۲ سال پیش)
descriptionsolution.cpp ۵۶ خط • ۷۷۴ بایت
1#include <iostream>
2using namespace std;
3int main()
4{
5 int n , m;
6 cin >> n >> m;
7 int Arr[n] , arr[m];
8
9 for ( int i = 0 ; i < n ; i ++ )
10 {
11 cin >> Arr[i];
12 }
13
14 for ( int i = 0 ; i < m ; i ++ )
15 {
16 cin >> arr[i];
17 }
18
19 int indx1 = 0;
20 int indx2 = 0;
21 while ( indx2 < m )
22 {
23 if ( Arr[indx1] == arr[indx2] )
24 {
25 indx2 ++;
26 }
27
28 else
29 {
30 break;
31 }
32
33 if ( indx1 == n - 1 )
34 {
35 indx1 = 0;
36 }
37
38 else
39 {
40 indx1 ++;
41 }
42 }
43
44 if ( indx2 == m )
45 {
46 cout << "Yes";
47 }
48
49 else
50 {
51 cout << "No";
52 }
53
54
55 return 0;
56}
کد ارسال‌شده برای داوری خودکار هاتکدز UTF-8