Submission #1771165
Source Code Expand
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ List<long> L = new List<long>(); for(int i=0;i<N;i++){ L.Add(A[i] * 2 + 0); } for(int i=0;i<M;i++){ L.Add(B[i] * 2 + 1); } L.Sort(); long ans = 0; long ver = M + 1; long hor = N + 1; foreach(var cd in L){ long len = cd / 2; long dir = cd % 2; if(dir == 0){ ans += ver * len; hor--; } else { ans += hor * len; ver--; } } Console.WriteLine(ans); } int N,M; long[] A,B; public Sol(){ var d = ria(); N = d[0]; M = d[1]; A = new long[N]; B = new long[M]; for(int i=0;i<N;i++) A[i] = rl(); for(int i=0;i<M;i++) B[i] = rl(); } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);} static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));} static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));} static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));} }
Submission Info
Submission Time | |
---|---|
Task | C - Gr-idian MST |
User | kuuso |
Language | C# (Mono 4.6.2.0) |
Score | 500 |
Code Size | 1546 Byte |
Status | AC |
Exec Time | 486 ms |
Memory | 22488 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 160 ms | 18392 KB |
02.txt | AC | 154 ms | 20440 KB |
03.txt | AC | 154 ms | 20440 KB |
04.txt | AC | 153 ms | 20440 KB |
05.txt | AC | 153 ms | 20440 KB |
06.txt | AC | 154 ms | 20440 KB |
07.txt | AC | 155 ms | 20440 KB |
08.txt | AC | 156 ms | 22488 KB |
09.txt | AC | 153 ms | 20440 KB |
10.txt | AC | 155 ms | 22488 KB |
11.txt | AC | 152 ms | 20440 KB |
12.txt | AC | 332 ms | 20440 KB |
13.txt | AC | 206 ms | 20440 KB |
14.txt | AC | 153 ms | 20440 KB |
15.txt | AC | 152 ms | 18392 KB |
16.txt | AC | 89 ms | 17884 KB |
17.txt | AC | 89 ms | 19932 KB |
18.txt | AC | 88 ms | 17884 KB |
19.txt | AC | 93 ms | 15836 KB |
20.txt | AC | 109 ms | 20444 KB |
21.txt | AC | 139 ms | 20444 KB |
22.txt | AC | 130 ms | 20444 KB |
23.txt | AC | 486 ms | 20444 KB |
24.txt | AC | 136 ms | 20440 KB |
25.txt | AC | 24 ms | 11348 KB |
26.txt | AC | 24 ms | 11220 KB |
27.txt | AC | 24 ms | 11220 KB |
28.txt | AC | 24 ms | 9300 KB |
s1.txt | AC | 24 ms | 9300 KB |
s2.txt | AC | 25 ms | 13396 KB |