• 2018 女生赛 F


    著名出题人小Q每次比赛后都会写一份《赛题分析》,包含比赛概况、每题的参考算法以及一些统计数值。

    对于一道题来说,小Q会统计最短的验题人代码长度(Shortest judge solution)以及赛内参赛队伍最短的AC代码长度(Shortest team solution)。

    统计验题人代码长度比较容易,因为验题人最多也不会超过2020 个。但是统计选手代码长度就不容易了,因为大赛区动辄三四百支队伍。

    请写一个程序,帮助小Q统计最短代码长度。Input第一行包含一个正整数T(1T13)T(1≤T≤13) ,表示赛题数量。

    每道题第一行包含两个整数n,m(2n20,0m500)n,m(2≤n≤20,0≤m≤500) ,分别表示验题人数量以及AC了该题的队伍数量。

    第二行包含nn 个正整数a1,a2,...,an(50ai65536)a1,a2,...,an(50≤ai≤65536) ,依次表示每个验题人的代码字节数。

    第三行包含mm 个正整数b1,b2,...,bn(50bi65536)b1,b2,...,bn(50≤bi≤65536) ,依次表示每支AC队伍的代码字节数。若m=0m=0 则该行为空行。
    Output对于第i(1iT)i(1≤i≤T) 道题,输出三行,第一行输出Problem xx :,其中x=i+1000x=i+1000 。

    第二行输出Shortest judge solution: yy bytes.,其中yy 表示最短的验题人代码字节数。

    第三行输出Shortest team solution: zz bytes.,其中zz 表示最短的选手代码字节数,若不存在请输出N/A。

    注意:间隔都是一个空格。
    Sample Input

    2
    3 2
    3627 1460 5288
    2365 2671
    2 0
    5510 7682

    Sample Output

    Problem 1001:
    Shortest judge solution: 1460 bytes.
    Shortest team solution: 2365 bytes.
    Problem 1002:
    Shortest judge solution: 5510 bytes.
    Shortest team solution: N/A bytes.
    #include <cstdio>
    #include <iostream>
    #include <string>
    #include <cstring>
    #include <cmath>
    #include <algorithm>
    #include <queue>
    #include <vector>
    #include <map>
    using namespace std;
    
    int t, n, m, a[20+8], b[500+8];
    
    int main()
    {
        scanf("%d", &t);
        int miao = t;
        while(t--)
        {
            scanf("%d%d", &n, &m);
            if(n != 0)
            {
                for(int i = 0; i<n; i++)
                    scanf("%d", &a[i]);
                sort(a, a+n);
            }
            if(m != 0)
            {
                for(int i = 0; i<m; i++)
                    scanf("%d",&b[i]);
                sort(b, b+m);
            }
            printf("Problem %d:
    ", 1000+(miao-t));
            if(n != 0)printf("Shortest judge solution: %d bytes.
    ", a[0]);
            else printf("Shortest judge solution: N/A bytes.
    ");
            if(m != 0)printf("Shortest team solution: %d bytes.
    ", b[0]);
            else printf("Shortest team solution: N/A bytes.
    ");
        }
        return 0;
    }
  • 相关阅读:
    CreateDatabase is not supported by the provider
    SQLServer 查看耗时较多的SQL语句(转)
    Unity下调试ToLua(基于IDEA和VSCode)
    《Javascript高级程序设计》读书笔记——函数与闭包
    《Javascript高级程序设计》读书笔记——继承与原型链
    《Javascript高级程序设计》读书笔记——构造函数与原型
    客户端地图内寻路总结与优化
    《程序员的自我修养》读书笔记 第二章 编译和链接
    客户端GUI结构学习总结
    关于浏览器的页面渲染
  • 原文地址:https://www.cnblogs.com/RootVount/p/10886723.html
Copyright © 2020-2023  润新知