zoukankan      html  css  js  c++  java
  • CF A and B and Compilation Errors (排序)

    A and B and Compilation Errors
    time limit per test
    2 seconds
    memory limit per test
    256 megabytes
    input
    standard input
    output
    standard output

    A and B are preparing themselves for programming contests.

    B loves to debug his code. But before he runs the solution and starts debugging, he has to first compile the code.

    Initially, the compiler displayed n compilation errors, each of them is represented as a positive integer. After some effort, B managed to fix some mistake and then another one mistake.

    However, despite the fact that B is sure that he corrected the two errors, he can not understand exactly what compilation errors disappeared — the compiler of the language which B uses shows errors in the new order every time! B is sure that unlike many other programming languages, compilation errors for his programming language do not depend on each other, that is, if you correct one error, the set of other error does not change.

    Can you help B find out exactly what two errors he corrected?

    Input

    The first line of the input contains integer n (3 ≤ n ≤ 105) — the initial number of compilation errors.

    The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the errors the compiler displayed for the first time.

    The third line contains n - 1 space-separated integers b1, b2, ..., bn - 1 — the errors displayed at the second compilation. It is guaranteed that the sequence in the third line contains all numbers of the second string except for exactly one.

    The fourth line contains n - 2 space-separated integers с1, с2, ..., сn - 2 — the errors displayed at the third compilation. It is guaranteed that the sequence in the fourth line contains all numbers of the third line except for exactly one.

    Output

    Print two numbers on a single line: the numbers of the compilation errors that disappeared after B made the first and the second correction, respectively.

    Sample test(s)
    input
    5
    1 5 8 123 7
    123 7 5 1
    5 1 7
    output
    8
    123
    input
    6
    1 4 3 3 5 7
    3 7 5 4 3
    4 3 7 5
    output
    1
    3




    排序后对比,若发现不同,那么就证明此数被删了
     1 #include <iostream>
     2 #include <cstring>
     3 #include <algorithm>
     4 #include <cstdio>
     5 using    namespace    std;
     6 
     7 int    main(void)
     8 {
     9     int    n;
    10     int    s_1[100005] = {0};
    11     int    s_2[100005] = {0};
    12     int    s_3[100005] = {0};
    13 
    14     scanf("%d",&n);
    15     for(int i = 0;i < n;i ++)
    16         scanf("%d",&s_1[i]);
    17     for(int i = 0;i < n - 1;i ++)
    18         scanf("%d",&s_2[i]);
    19     for(int i = 0;i < n - 2;i ++)
    20         scanf("%d",&s_3[i]);
    21 
    22     sort(s_1,s_1 + n);
    23     sort(s_2,s_2 + n - 1);
    24     sort(s_3,s_3 + n - 2);
    25 
    26     for(int i = 0;i < n;i ++)
    27         if(s_1[i] != s_2[i])
    28         {
    29             printf("%d
    ",s_1[i]);
    30             break;
    31         }
    32     for(int i = 0;i < n - 1;i ++)
    33         if(s_2[i] != s_3[i])
    34         {
    35             printf("%d
    ",s_2[i]);
    36             break;
    37         }
    38 
    39     return    0;
    40 }
  • 相关阅读:
    linux学习(六)计划任务命令
    如何在在手机上安装linux(ubuntu )关键词:Termux
    linux学习(五)用户与组管理命令,以及用户信息文件解释
    linux学习(四)复制(cp)移动(mv)删除(rm)查找(find)文件、文件夹操作、软硬链接的区别
    Flutter中通过https post Json接收Json
    Api管家系列(一):初探
    Api管家系列(三):测试和Rest Client
    Api管家系列(二):编辑和继承Class
    JDK8 时间相关API基本使用
    windows杀端口
  • 原文地址:https://www.cnblogs.com/xz816111/p/4439204.html
Copyright © 2011-2022 走看看