Submission #1632596
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; using System.Text; struct P { public bool y; public int l; public P(bool y,int l) { this.y=y; this.l=l; } } class Program { private int W,H; private P[] PQ; private void Scan() { var l=Console.ReadLine().Split(' '); W=int.Parse(l[0]); H=int.Parse(l[1]); PQ=new P[H+W]; for(int i=0;i<W;i++) { PQ[i]=new P(false,int.Parse(Console.ReadLine())); } for(int i=0;i<H;i++) { PQ[i+W]=new P(true,int.Parse(Console.ReadLine())); } } private void Calc() { Array.Sort(PQ,(aa,bb)=>aa.l.CompareTo(bb.l)); long ans=0; int a=W+1; int b=H+1; foreach(var p in PQ) { if(!p.y) { ans+=b*p.l; a--; } else { ans+=a*p.l; b--; } } Console.WriteLine(ans); } public void Solve() { Scan(); Calc(); } static void Main() { new Program().Solve(); } }
Submission Info
Submission Time | |
---|---|
Task | C - Gr-idian MST |
User | mban |
Language | C# (Mono 4.6.2.0) |
Score | 0 |
Code Size | 1297 Byte |
Status | WA |
Exec Time | 215 ms |
Memory | 18652 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 171 ms | 14680 KB |
02.txt | WA | 171 ms | 16728 KB |
03.txt | WA | 177 ms | 16728 KB |
04.txt | WA | 174 ms | 16728 KB |
05.txt | WA | 172 ms | 14680 KB |
06.txt | WA | 170 ms | 16600 KB |
07.txt | WA | 169 ms | 16600 KB |
08.txt | WA | 171 ms | 16728 KB |
09.txt | WA | 169 ms | 14680 KB |
10.txt | WA | 189 ms | 16728 KB |
11.txt | WA | 173 ms | 14680 KB |
12.txt | WA | 166 ms | 16728 KB |
13.txt | WA | 200 ms | 16600 KB |
14.txt | WA | 167 ms | 16600 KB |
15.txt | WA | 168 ms | 16600 KB |
16.txt | WA | 95 ms | 15836 KB |
17.txt | WA | 95 ms | 15836 KB |
18.txt | WA | 97 ms | 15836 KB |
19.txt | WA | 98 ms | 15836 KB |
20.txt | AC | 116 ms | 14684 KB |
21.txt | AC | 144 ms | 18652 KB |
22.txt | AC | 153 ms | 14684 KB |
23.txt | WA | 215 ms | 14556 KB |
24.txt | WA | 141 ms | 14680 KB |
25.txt | AC | 22 ms | 9172 KB |
26.txt | AC | 23 ms | 11220 KB |
27.txt | AC | 22 ms | 9172 KB |
28.txt | AC | 23 ms | 11220 KB |
s1.txt | AC | 22 ms | 9172 KB |
s2.txt | AC | 22 ms | 9172 KB |