-
Notifications
You must be signed in to change notification settings - Fork 0
/
CHEFTET.cs
90 lines (85 loc) · 3.41 KB
/
CHEFTET.cs
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// Not solved
namespace MMT_Elitmus
{
class CHEFTET
{
static string[] B = null;
static string[] A = null;
static void Main1(string[] srgs)
{
int t = Convert.ToInt32(Console.ReadLine());
while (t-- > 0)
{
B = Console.ReadLine().Split(' ');
A = Console.ReadLine().Split(' ');
Dictionary<string, int> possiblevals = new Dictionary<string, int>();
for (int i = 0; i < A.Length; i++)
{
if (i == 0)
{
possiblevals.Add("AboveRight", Convert.ToInt32(A[i]) + Convert.ToInt32(B[i]) + Convert.ToInt32(B[i + 1]));
possiblevals.Add("Alone", Convert.ToInt32(A[i]));
possiblevals.Add("Above", Convert.ToInt32(A[i]) + Convert.ToInt32(B[i]));
possiblevals.Add("Right", Convert.ToInt32(A[i]) + Convert.ToInt32(B[i + 1]));
}
if (i == A.Length - 1)
{
}
else
{
Dictionary<string, int> Newpossiblevals = new Dictionary<string, int>();
List<string> valsToDelete = new List<string>();
foreach (var item in possiblevals)
{
switch(item.Key)
{
case "AboveRight":
int f = addRightElement(i);
if (f == item.Value)
{
Newpossiblevals.Add("Right", item.Value);
valsToDelete.Add("AboveRight");
}
if (item.Value == Convert.ToInt32(A[i]))
{
// Newpossiblevals.Add("Alone", item.Value);
// valsToDelete.Add("AboveRight");
}
break;
}
}
}
}
}
}
static int addAboveElement(int i)
{
return Convert.ToInt32(A[i]) + Convert.ToInt32(B[i]);
}
static int addLeftElement(int i)
{
return Convert.ToInt32(A[i]) + Convert.ToInt32(B[i -1]);
}
static int addLeftAboveElement(int i)
{
return Convert.ToInt32(A[i]) + Convert.ToInt32(B[i]) + Convert.ToInt32(B[i - 1]);
}
static int addRightElement(int i)
{
return Convert.ToInt32(A[i]) + Convert.ToInt32(B[i + 1]);
}
static int addRightAboveElement(int i)
{
return Convert.ToInt32(A[i]) + Convert.ToInt32(B[i]) + Convert.ToInt32(B[i + 1]);
}
static int addLeftRightAboveElement(int i)
{
return Convert.ToInt32(A[i]) + Convert.ToInt32(B[i]) + Convert.ToInt32(B[i + 1]) + Convert.ToInt32(B[i - 1]);
}
}
}