Codeforces 519B A and B and compilation Errors "Analog"

Source: Internet
Author: User

The topic meaning is quite simple, look at the input data output data is more obvious

I can write it in sort or AC.

//#pragma COMMENT (linker, "/stack:16777216")//For C + + Compiler#include <stdio.h>#include<iostream>#include<fstream>#include<cstring>#include<cmath>#include<stack>#include<string>#include<map>#include<Set>#include<list>#include<queue>#include<vector>#include<algorithm>#defineMax (b) ((a) > (b))? (a): (b))#defineMin (b) ((a) < (a))? (a): (b))#defineAbs (x) (((x) > 0)? (x): (-(x)))#defineMOD 1000000007#definePi ACOs (-1.0)using namespaceStd;typedefLong Longll; typedef unsignedLong Longull; typedef unsignedint        UINT; typedef unsignedCharUchar; template<classT> InlinevoidCheckmin (T &a,t b) {if(a>b) a=b;} Template<classT> InlinevoidCheckmax (T &a,t b) {if(a<b) a=b;}Const DoubleEPS = 1e-7      ;Const intN = About            ;Const intM =1100011*2      ;Constll P =10000000097ll;Const intMAXN =10900000    ;Const intINF =0x3f3f3f3f   ;Const intoffset = -       ;inta[120000], b[120000], c[120000];intN;intMain () {Std::ios::sync_with_stdio (false); intI, J, T, K, U, V, numcase =0; CIN>>N;  for(i =0; I < n; ++i) Cin >>A[i];  for(i =0; I < n-1; ++i) Cin >>B[i];  for(i =0; I < n-2; ++i) Cin >>C[i]; Sort (A, a+N); Sort (b, B+ N-1); Sort (c, C+ N-2);  for(i =0; I < n-1; ++i) {if(A[i]! =B[i]) {cout<< A[i] <<Endl;  Break; }    }    if(i = = N-1) {cout<< A[n-1] <<Endl; }     for(i =0; I < n-2; ++i) {if(B[i]! =C[i]) {cout<< B[i] <<Endl;  Break; }    }    if(i = = N-2) {cout<< B[n-2] <<Endl; }    return 0;}
Sort Solution

But there is a quicker way to read the official solution.

Because the size of the data in the N-10^5 ai-10 ^ 9, if all the numbers to make an accumulation of words can be stored in a long long type of variable

Source Code:

/****************************************** Solution by Bekzhan Kassenov **************************************** **/#include<bits/stdc++.h>using namespacestd;#defineF First#defineS Second#defineMP Make_pair#defineAll (x) (x). Begin (), (x). End ()typedefLong Longll;typedef unsignedLong LongUll;typedefLong Doubleld;Const DoubleEPS = 1e-9;Const DoublePI = ACOs (-1.0);Const intMOD = +* +* ++7;Const intINF = -* +* +; template<typename t>inline T Sqr (t N) {returnn *N;}intn, x;Long LongA, B, C;intMain () {#ifndef Online_judge freopen ("inch","R", stdin);#endifscanf ("%d", &N);  for(inti =0; I < n; i++) {scanf ("%d", &x); A+=x; }     for(inti =0; I < n-1; i++) {scanf ("%d", &x); b+=x; }     for(inti =0; I < n-2; i++) {scanf ("%d", &x); C+=x; } printf ("%i64d\n%i64d\n", A-A, B-c); return 0;}

Codeforces 519B A and B and compilation Errors "Analog"

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.