"Bzoj" 3850:ZCC Loves codefires (300T is dedicated to water title tat)

Source: Internet
Author: User

http://www.lydsy.com/JudgeOnline/problem.php?id=3850

Test instructions: Like King game .... No meaning.

#include <cstdio> #include <cstring> #include <cmath> #include <string> #include <iostream > #include <algorithm> #include <queue> #include <set> #include <map> #include <sstream >using namespace Std;typedef long long ll; #define PB Push_back#define Rep (i, n) for (int i=0; i< (n); ++i) #define For1 (i,a,n) for (int i= (a), i<= (n), ++i) #define FOR2 (i,a,n) for (int i= (a);i< (n), ++i) #define FOR3 (i,a,n) for (int i= (a); I >= (n); i) #define FOR4 (i,a,n) for (int i= (a);i> (n); i) #define CC (i,a) memset (i,a,sizeof (i)) #define READ (a) a=  Getint () #define PRINT (a) printf ("%d", a) #define DBG (x) cout << (#x) << "=" << (x) << Endl#define Error (x) (! ( x) puts ("error"): 0) #define RDM (x, i) for (int i=ihead[x]; i; i=e[i].next) inline int getint () {static int r, K; r=0,k=1; St Atic Char C; C=getchar (); for (; c< ' 0 ' | | C> ' 9 '; C=getchar ()) if (c== '-') k=-1; for (; c>= ' 0 ' &&c<= ' 9 '; C=getchar ()) r=r*10+c-' 0 '; return k*r; }const int n=1e5+10;struct dat {int x, y;} A[n];ll ans;int n;bool cmp (const dat &a, const dat &b) {return a.y*a.x+b.y* (a.x+b.x) <b.y*b.x+a.y* (a.x+b.x);} int main () {read (n); Rep (i, N) read (a[i].x); Rep (i, N) read (A[I].Y); sort (A, a+n, CMP); ll Sum=0;rep (i, N) sum+=a[i].x, ans+= Sum*a[i].y;cout << Ans;return 0;}

  

300T is dedicated to this water-problem tat.

"Bzoj" 3850:ZCC Loves codefires (300T is dedicated to water title tat)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.