// zmiana czasu runda 1 B
#include <iostream>
#include<algorithm>
using namespace std;
long ileDni;
long ileSpotkan;
int tab[500000];
long ileDodac()
{
long ile = 0;
sort(tab, tab+ileSpotkan);
long pop=tab[0];
for(long i=1; i<ileSpotkan; i++)
{
if(tab[i]==pop && pop !=0) ile++;
pop=tab[i];
}
return ile;
}
int main()
{
long max=0;
cin >> ileDni >> ileSpotkan;
max = ileSpotkan;
long ilePlus;
for(long i=0; i<ileDni-1; ++i)
{
cin >> ileSpotkan;
for(long j=0; j<ileSpotkan; j++)
{
cin >> tab[j];
}
ilePlus = ileDodac();
if(max+ ilePlus > ileSpotkan) max = max+ ilePlus;
else max = ileSpotkan;
}
cout<< max << endl;
// cout.flush();
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | // zmiana czasu runda 1 B #include <iostream> #include<algorithm> using namespace std; long ileDni; long ileSpotkan; int tab[500000]; long ileDodac() { long ile = 0; sort(tab, tab+ileSpotkan); long pop=tab[0]; for(long i=1; i<ileSpotkan; i++) { if(tab[i]==pop && pop !=0) ile++; pop=tab[i]; } return ile; } int main() { long max=0; cin >> ileDni >> ileSpotkan; max = ileSpotkan; long ilePlus; for(long i=0; i<ileDni-1; ++i) { cin >> ileSpotkan; for(long j=0; j<ileSpotkan; j++) { cin >> tab[j]; } ilePlus = ileDodac(); if(max+ ilePlus > ileSpotkan) max = max+ ilePlus; else max = ileSpotkan; } cout<< max << endl; // cout.flush(); return 0; } |
English