90112024-02-12 00:31:22AncsaCsúcsokcpp17Wrong answer 0/10059ms5572 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;
   bool ano=false, bno=false;
   for(int i = 0; i<n;i++)
   {
      cin>>a[i];
      if(n==2)
      {
        if (i==1 && a[0]!=a[1])
            maxa++;
      }
      else if (n>2)
      {
         if (i==1)
         {
             if (a[0]>a[1])
             {
                maxa++;
                ano=false;
             }
             else
                ano=true;
         }
         else if (i!=0 && i<n)
         {
             if (ano && a[i]<a[i-1])
             {
                 maxa++;
                 ano=false;
             }
             else if (a[i]<=a[i-1])
             {
                 ano==false;
             }
             else
                ano=true;
         }
      }
      //cout<<maxa<<"    "<<ano<<endl;
   }
   if (ano)
     maxa++;
   //cout<<maxa<<endl;

   for(int i = 0; i<m;i++)
   {
      cin>>b[i];
      if(m==2)
      {
        if (i==1 && b[0]!=b[1])
            maxb++;
      }
      else if (m>2)
      {
         if (i==1)
         {
             if (b[0]>b[1])
             {
                 maxb++;
                 bno=false;
             }
             else
                bno=true;
         }
         else if (i!=0 && i<m)
         {

             if (b[i]<=b[i-1])
             {
                 if (bno)
                    maxb++;
                 bno=false;
             }
             else
                bno=true;
         }
      }
     // cout<<maxb<<"   "<<bno<<endl;
   }
   if (bno)
     maxb++;
   //cout<<maxb<<endl;
   //cout<<"+++";
   cout<<maxa*maxb;
}

SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1744 KiB
2Accepted3ms2072 KiB
subtask20/16
3Wrong answer30ms2848 KiB
4Wrong answer25ms2840 KiB
5Wrong answer20ms3108 KiB
6Wrong answer30ms3324 KiB
7Wrong answer29ms3404 KiB
8Wrong answer29ms3516 KiB
subtask30/33
9Accepted3ms2852 KiB
10Wrong answer3ms3004 KiB
11Accepted3ms3132 KiB
12Accepted3ms3244 KiB
13Accepted3ms3212 KiB
14Accepted3ms3340 KiB
15Accepted3ms3428 KiB
subtask40/51
16Wrong answer59ms5096 KiB
17Wrong answer34ms4460 KiB
18Wrong answer59ms5196 KiB
19Wrong answer30ms4468 KiB
20Wrong answer30ms4576 KiB
21Wrong answer59ms5480 KiB
22Wrong answer59ms5464 KiB
23Wrong answer50ms5340 KiB
24Wrong answer59ms5572 KiB