4616 | 2023. 03. 30 12:15:27 | csicsilla70 | Kert (75 pont) | csharp | Futási hiba 56/75 | 395ms | 78768 KiB |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace kert
{
class Program
{
static void Main(string[] args)
{
int[] in1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
int[] S;
int[] p = new int[in1[2]];
int max;
int o1 = 0, o2 = 0, o2m = 0;
for (int i = 0, j, last; i < in1[0]; i++)
{
S = Console.ReadLine().Split().Select(int.Parse).ToArray();
HashSet<int> x = new HashSet<int>(S);
Dictionary<int, int> y = new Dictionary<int, int>();
foreach (var item in x)
{
y.Add(item, 0);
}
foreach (var item in S)
{
y[item]++;
}
max = y.Values.Max();
if(max > in1[1] / 2) o1++;
last = 0;
o2 = 1;
//p = new int[in1[2]];
for (j = 0; j < in1[1]; j++)
{
// p[S[j] - 1]++;
if (S[j] == last)
{
o2++;
if (o2 > o2m)
{
//o2t = i;
o2m = o2;
}
}
else
o2 = 1;
last = S[j];
}
}
Console.WriteLine(o1 + "\n" + o2m);
Console.ReadKey();
}
}
}
Részfeladat | Összpont | Teszt | Verdikt | Idő | Memória | ||
---|---|---|---|---|---|---|---|
base | 56/75 | ||||||
1 | Elfogadva | 0/0 | 39ms | 23296 KiB | |||
2 | Futási hiba | 0/0 | 209ms | 78768 KiB | |||
3 | Elfogadva | 4/4 | 37ms | 23996 KiB | |||
4 | Elfogadva | 4/4 | 37ms | 24476 KiB | |||
5 | Elfogadva | 4/4 | 37ms | 25392 KiB | |||
6 | Elfogadva | 4/4 | 39ms | 25680 KiB | |||
7 | Elfogadva | 4/4 | 39ms | 26048 KiB | |||
8 | Elfogadva | 4/4 | 37ms | 26392 KiB | |||
9 | Elfogadva | 4/4 | 37ms | 26948 KiB | |||
10 | Elfogadva | 4/4 | 48ms | 29312 KiB | |||
11 | Elfogadva | 6/6 | 43ms | 27668 KiB | |||
12 | Elfogadva | 6/6 | 56ms | 31652 KiB | |||
13 | Elfogadva | 6/6 | 90ms | 43560 KiB | |||
14 | Elfogadva | 6/6 | 395ms | 74860 KiB | |||
15 | Futási hiba | 0/6 | 197ms | 75604 KiB | |||
16 | Futási hiba | 0/6 | 181ms | 75520 KiB | |||
17 | Futási hiba | 0/7 | 182ms | 75528 KiB |