2272021-03-05 10:40:20mraronKert (75 pont)cpp14Accepted 75/75194ms12908 KiB
/* Kert feladat
   M*N ido es csak egy sort tarol el 700.000*4<3MB
   Optimalis megoldas, 100p
*/
#include <iostream>
#include <vector>

using namespace std;

vector <int> x;
int m,n,p,t,i,j,maxi,sormaxi,sortobbseg,db,szin,tszin,tdb,c;

int main()
{
    cin>>m>>n>>p;
    x.resize(n);
    t=n/2;
    for(i=1;i<=m;i++)
    {
        x.clear();
        cin>>x[0];
        szin=x[0];
        tszin=x[0];
        tdb=1;
        db=1;
        maxi=1;
        for(j=1;j<n;j++)
        {
            cin>>x[j];
            if(x[j]==szin) db++;
            else
            {
                szin=x[j];
                db=1;
            }
            if(db>maxi) maxi=db;
            if(x[j]==tszin) tdb++;
            else tdb--;
            if(tdb<0)
            {
                tszin=x[j];
                tdb=1;
            }
        }
        if(maxi>sormaxi) sormaxi=maxi;
        c=0;
        for(j=0;j<n;j++)
            if(x[j]==tszin) c++;
        if(c>=t+1) sortobbseg++;
    }
    cout<<sortobbseg<<"\n"<<sormaxi;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/02ms1804 KiB
2Accepted0/0170ms5796 KiB
3Accepted4/41ms5804 KiB
4Accepted4/41ms5808 KiB
5Accepted4/41ms5816 KiB
6Accepted4/41ms5820 KiB
7Accepted4/41ms5824 KiB
8Accepted4/41ms5824 KiB
9Accepted4/41ms5836 KiB
10Accepted4/44ms5848 KiB
11Accepted6/62ms5896 KiB
12Accepted6/625ms6036 KiB
13Accepted6/619ms6440 KiB
14Accepted6/6160ms9804 KiB
15Accepted6/6164ms12908 KiB
16Accepted6/6194ms12264 KiB
17Accepted7/7100ms12240 KiB