zoukankan      html  css  js  c++  java
  • 1233

    JSZKC is the captain of the lala team.

    There are NN girls in the lala team. And their height is [1,N][1,N] and distinct. So it means there are no two girls with a same height.

    JSZKC has to arrange them as an array from left to right and let h_ihi be the height of the i^{th}ith girl counting from the left. After that, he can calculate the sum of the inversion pairs. A inversion pair counts if h_i>h_jhi>hj with i<ji<j.

    Now JSZKC wants to know how many different arranging plans with the sum of the inversion pairs equaling KK. Two plans are considered different if and only if there exists an ii with h_ihi different in these two plans.

    As the answer may be very large, you should output the answer mod 10000000071000000007.

    Input Format

    The input file contains several test cases, each of them as described below.

    • The first line of the input contains two integers NN and K(1 le N le 5000,0 le K le 5000)(1N5000,0K5000), giving the number of girls and the pairs that JSZKC asked.

    There are no more than 50005000 test cases.

    Output Format

    An integer in one line for each test case, which is the number of the plans mod 10000000071000000007.

    样例输入

    3 2
    3 3

    样例输出

    2
    1

    题目来源

    The 2018 ACM-ICPC China JiangSu Provincial Programming Contest

     

     

     

     1 #include <iostream>
     2 #include <algorithm>
     3 #include <cstring>
     4 #include <cstdio>
     5 #include <vector>
     6 #include <queue>
     7 #include <stack>
     8 #include <cstdlib>
     9 #include <iomanip>
    10 #include <cmath>
    11 #include <cassert>
    12 #include <ctime>
    13 #include <map>
    14 #include <set>
    15 using namespace std;
    16 int n,m,k;
    17 int a[15][2];
    18 const int N=2311;
    19 int vis[N][N];
    20 int x,y,val;
    21 const int  inf=0x3f3f3f3f;
    22 int   main()
    23 {
    24     while(~scanf("%d%d",&n,&m)){
    25         memset(vis,inf,sizeof(vis));
    26         val=-1;
    27         scanf("%d",&k);
    28         for(int i=0;i<k;i++){
    29             scanf("%d%d",&a[i][0],&a[i][1]);
    30         }
    31         for(int i=1;i<=n;i++){
    32             for(int j=1;j<=m;j++){
    33                 for(int ii=0;ii<k;ii++){
    34                     vis[i][j]=min(vis[i][j],abs(i-a[ii][0])+abs(j-a[ii][1]));
    35                 }
    36                 if(vis[i][j]>val){
    37                     val=vis[i][j];
    38                     x=i;
    39                     y=j;
    40                 }
    41                 else if(vis[i][j]==val){
    42                     if(i<x){
    43                         x=i;
    44                         y=j;
    45                     }
    46                     else if(i==x) y=min(y,j);
    47                 }
    48             }
    49         }
    50         printf("%d %d
    ",x,y);
    51     }
    52     return  0;
    53 }
  • 相关阅读:
    行测(爆发篇)之图形推理
    行测(爆发篇)之资料分析
    申论(准备篇)之申论思维
    行测(基础篇)之基础常识复习建议
    行测(基础篇)之汉语语法与阅读习惯梳理
    行测笔记整理
    申论之日积月累
    申论(准备篇)之大纲的五个隐藏秘密
    行测(基础篇)之中学知识回顾
    申论(准备篇)之找好方向
  • 原文地址:https://www.cnblogs.com/tingtin/p/9363327.html
Copyright © 2011-2022 走看看