zoukankan      html  css  js  c++  java
  • ural 2021 Scarily interesting!(贪心)

    2021. Scarily interesting!

    Time limit: 1.0 second
    Memory limit: 64 MB
    This year at Monsters University it is decided to arrange Scare Games. At the Games all campus gathers at the stadium stands, and the Scare program students divide into two teams to compete in their abilities of scaring children. This year the two teams will be “Oozma Kappa” and “Roar Omega Roar”.
    Each team has n monsters, and the Games consist of n challenges. During each challenge Dean Hardscrabble, the chair of the Scare program, invites one monster from each team to demonstrate his mastery. Each of the monsters is invited only once and scores from 0 to 6 points, depending on how much a child is scared. The results of each challenge are announced at the same time for both monsters right after the end of this challenge. The winning team will be identified by the sum of the points scored by all its members.
    Sports competition is an unpredictable process. But the Dean wants to keep all the course of the Games under control, so that the identity of the winning team will have been unclear for the audience as long as possible. For example, if six challenges until the end “Oozma Kappa” is forty points ahead, the audience at the stadium stands will just lose interest to the game. The Dean knows the skill level of all her students, and she wants to decide beforehand the order in which both teams’ members will be participating in the challenges. In what order should monsters from “Oozma Kappa” and from “Roar Omega Roar” show up to keep the audience in suspense as long as possible?

    Input

    The first line contains an integer n (2 ≤ n ≤ 1 000). The second line contains n integers within the range from 0 to 6, which are the points monsters from “Oozma Kappa” will score. The third line contains the points, monsters from “Roar Omega Roar” will score, written in the same manner.

    Output

    Output n lines, each containing integers oi and ri, which are the numbers of monsters from “Oozma Kappa” and “Roar Omega Roar” respectively, who should be called by the Dean to take part in the i-th challenge. In each team monsters are numbered with integers from 1 to n in the order they appear in the input data. If the problem has several solutions, output any of them.

    Sample

    inputoutput
    5
    0 1 4 3 6
    6 5 1 3 0
    
    5 1
    1 5
    4 4
    2 3
    3 2
    
    Problem Author: Oleg Dolgorukov
    Problem Source: NEERC 2014, Eastern subregional contest
  • 相关阅读:
    vector读入指定行数但不指定列数的数字
    p4语言编程环境安装
    近期学习资料一览表
    c++之洛谷P1068分数线划定
    打开文件的方法
    调用当前年月日
    想学习启发式优化算法,不知从何学起?
    使用这几款插件,能让你在GitHub看代码的效率翻倍
    微信公众号放Latex数学公式的完美解决方案
    手把手教你用Git备份保存论文和代码等重要数据到云端
  • 原文地址:https://www.cnblogs.com/gongpixin/p/6790400.html
Copyright © 2011-2022 走看看