Submission #806484
Source Code Expand
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; public class Don { public Don() { } private Reader r = new Reader(); public void Solve() { var N = r.nextInt(); var list = new List<int>(); for(var i = 0; i < 2 * N; i++) { var L = r.nextInt(); list.Add(L); } list.Sort(); var ret = 0; for(var i = 0; i < (2 * N) - 1; i += 2) { if (list[i] == list[i + 1]) { ret += list[i]; } else { ret += list[i] > list[i + 1] ? list[i + 1] : list[i]; } } Console.WriteLine(ret); } public static void Main(string[] args) { new Don().Solve(); } } class Reader { string[] s; int i; char[] cs = new char[] { ' ' }; public Reader() { s = new string[0]; i = 0; } public string next() { if (i < s.Length) return s[i++]; var input = Console.ReadLine(); while (input == "") input = Console.ReadLine(); s = input.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next(); } public int nextInt() { return int.Parse(next()); } public long nextLong() { return long.Parse(next()); } public double nextDouble() { return double.Parse(next()); } }
Submission Info
Submission Time | |
---|---|
Task | A - BBQ Easy |
User | oyakodon |
Language | C# (Mono 4.6.2.0) |
Score | 200 |
Code Size | 1636 Byte |
Status | AC |
Exec Time | 33 ms |
Memory | 2904 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt |
All | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 33 ms | 2904 KB |
01-02.txt | AC | 31 ms | 2648 KB |
01-03.txt | AC | 31 ms | 2648 KB |
01-04.txt | AC | 31 ms | 2648 KB |
01-05.txt | AC | 31 ms | 2648 KB |
01-06.txt | AC | 31 ms | 2648 KB |
01-07.txt | AC | 32 ms | 2648 KB |
01-08.txt | AC | 31 ms | 2648 KB |
sample-01.txt | AC | 31 ms | 2648 KB |
sample-02.txt | AC | 31 ms | 2648 KB |