Submission #1753342
Source Code Expand
#include<bits/stdc++.h> #define REP(i,n) for(int i=0;i<n;i++) #define LOOP(i,x,n) for(int i=x;i<n;i++) #define ALL(v) (v).begin(),(v).end() #define PB push_back #define MP make_pair #define FIR first #define SEC second #define int long long using namespace std; const int MOD=1000000007; const int INF=1000000009; signed main(){ int w,h,p; cin>>w>>h; vector<pair<int,int>> v; REP(i,w){ cin>>p; v.PB(MP(p,0)); } REP(i,h){ cin>>p; v.PB(MP(p,1)); } sort(ALL(v)); int sum=0,tmp; int pre=v[0].SEC; if(pre==0){ tmp=h+1; }else{ tmp=w+1; } sum+=tmp*v[0].FIR; LOOP(i,1,w+h){ if(pre==v[i].SEC){ sum+=tmp*v[i].FIR; pre=v[i].SEC; }else{ tmp-=1; sum+=tmp*v[i].FIR; pre=v[i].SEC; } } cout<<sum<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Gr-idian MST |
User | fuu32 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 853 Byte |
Status | WA |
Exec Time | 93 ms |
Memory | 6512 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 | 91 ms | 5104 KB |
02.txt | WA | 91 ms | 5616 KB |
03.txt | WA | 90 ms | 4848 KB |
04.txt | WA | 91 ms | 4720 KB |
05.txt | WA | 91 ms | 5616 KB |
06.txt | WA | 92 ms | 6000 KB |
07.txt | WA | 91 ms | 5872 KB |
08.txt | WA | 91 ms | 4592 KB |
09.txt | WA | 91 ms | 5744 KB |
10.txt | WA | 91 ms | 5872 KB |
11.txt | WA | 89 ms | 5488 KB |
12.txt | WA | 89 ms | 6256 KB |
13.txt | WA | 93 ms | 5616 KB |
14.txt | WA | 89 ms | 4976 KB |
15.txt | WA | 90 ms | 5616 KB |
16.txt | WA | 45 ms | 2420 KB |
17.txt | WA | 46 ms | 2420 KB |
18.txt | WA | 45 ms | 2420 KB |
19.txt | WA | 45 ms | 2420 KB |
20.txt | WA | 38 ms | 4720 KB |
21.txt | WA | 64 ms | 4464 KB |
22.txt | WA | 64 ms | 6512 KB |
23.txt | WA | 77 ms | 5872 KB |
24.txt | WA | 86 ms | 5488 KB |
25.txt | AC | 1 ms | 256 KB |
26.txt | AC | 1 ms | 256 KB |
27.txt | WA | 1 ms | 256 KB |
28.txt | AC | 1 ms | 256 KB |
s1.txt | AC | 1 ms | 256 KB |
s2.txt | AC | 1 ms | 256 KB |