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

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

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