90092024-02-11 22:58:37AncsaCsúcsokcpp17Wrong answer 16/10061ms5336 KiB
#include <iostream>

using namespace std;

int main()
{
   int n, m;
   cin>>n>>m;
   int a[n], b[m];
   int maxa=0, maxb=0;
   if (n==1) maxa=1;
   if (m==1) maxb=1;
   for(int i = 0; i<n;i++)
   {
      cin>>a[i];
      if(i==1 && a[0]>a[1])
        maxa++;
      else if (n>2 && i<n-1 && a[i]<a[i-1] && a[i-1]>a[i-2])
        maxa++;
      else if (n>2 && i==n-1 && ((a[n-1]>a[n-2]) ||  (a[n-1]<a[n-2] && a[n-2]>a[n-3])))
        maxa++;
      //cout<<endl<<maxa<<endl;
   }

   for(int i = 0; i<m;i++)
   {
      cin>>b[i];
      if(i==1 && b[0]>b[1])
        maxb++;
      else if (m>2 && i<m-1 && b[i]<b[i-1] && b[i-1]>b[i-2])
        maxb++;
      else if (m>2 && i==m-1 && ((b[m-1]>b[m-2]) ||  (b[m-1]<b[m-2] && b[m-2]>b[m-3])))
        maxb++;
      //cout<<endl<<maxb<<endl;
   }
   //cout<<maxa<< " "  << maxb<<endl;
   cout<<maxa*maxb;
}

SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1872 KiB
2Accepted3ms2124 KiB
subtask216/16
3Accepted32ms3140 KiB
4Accepted26ms3304 KiB
5Accepted21ms3660 KiB
6Accepted32ms3896 KiB
7Accepted32ms4008 KiB
8Accepted30ms3972 KiB
subtask30/33
9Accepted3ms3420 KiB
10Accepted3ms3508 KiB
11Accepted3ms3508 KiB
12Wrong answer3ms3508 KiB
13Accepted3ms3508 KiB
14Accepted3ms3660 KiB
15Accepted3ms3520 KiB
subtask40/51
16Wrong answer61ms5192 KiB
17Accepted35ms4528 KiB
18Accepted61ms5280 KiB
19Wrong answer32ms4484 KiB
20Wrong answer32ms4488 KiB
21Wrong answer61ms5264 KiB
22Accepted61ms5336 KiB
23Accepted52ms5088 KiB
24Accepted61ms5224 KiB