forked from hanemin/cs_practice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path@1.cs
More file actions
31 lines (31 loc) · 1022 Bytes
/
@1.cs
File metadata and controls
31 lines (31 loc) · 1022 Bytes
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
using System;
namespace _1 {
class Program {
//1<=n<=50
//1<=m<=1e8
//1<=k<=1e8
static int n, m;
static int[] k,tmp;
static bool solve() {
tmp = new int[n * n];
for (int i = 0; i < k.Length; i++)
for (int j = 0; j < k.Length; j++)
tmp[i] = k[i] + k[j];
Array.Sort(tmp);
for (int i = 0; i < k.Length; i++)
for (int j = 0; j < k.Length; j++)
if (Array.IndexOf(tmp, m - k[i] - k[j]) != -1)
return true;
return false;
}
static void Main(string[] args) {
n = int.Parse(Console.ReadLine());
m = int.Parse(Console.ReadLine());
k = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
if (solve())
Console.WriteLine("True");
else
Console.WriteLine("False");
}
}
}