• 2017 Multi-University Training Contest


    HDU 6045

     1 #pragma comment(linker, "/STACK:102400000,102400000")
     2 #include <cstdio>
     3 #include <iostream>
     4 #include <cstdlib>
     5 #include <cstring>
     6 #include <algorithm>
     7 #include <cmath>
     8 #include <cctype>
     9 #include <map>
    10 #include <set>
    11 #include <queue>
    12 #include <bitset>
    13 #include <string>
    14 #include <complex>
    15 #define ll long long
    16 #define mod 1000000007
    17 using namespace std;
    18 int t;
    19 int n,x,y;
    20 char a[80004],b[80004];
    21 int main()
    22 {
    23     scanf("%d",&t);
    24     for(int i=1;i<=t;i++){
    25         scanf("%d %d %d",&n,&x,&y);
    26         scanf("%s",a);
    27         scanf("%s",b);
    28         int res=0;
    29         for(int j=0;j<n;j++){
    30             if(a[j]==b[j])
    31                 res++;
    32         }
    33         if(x+y<=n+res&&abs(x-y)<=n-res)
    34             printf("Not lying
    ");
    35         else
    36             printf("Lying
    ");
    37     }
    38     return 0;
    39 }

    HDU 6047

     1 #pragma comment(linker, "/STACK:102400000,102400000")
     2 #include <cstdio>
     3 #include <iostream>
     4 #include <cstdlib>
     5 #include <cstring>
     6 #include <algorithm>
     7 #include <cmath>
     8 #include <cctype>
     9 #include <map>
    10 #include <set>
    11 #include <queue>
    12 #include <bitset>
    13 #include <string>
    14 #include <complex>
    15 #define ll long long
    16 #define mod 1000000007
    17 using namespace std;
    18 int n;
    19 ll a[250005];
    20 ll b[250005];
    21 ll dp[250005];
    22 int main()
    23 {
    24     while(scanf("%d",&n)!=EOF){
    25     for(int i=1;i<=n;i++)
    26         scanf("%lld",&a[i]);
    27     for(int i=1;i<=n;i++)
    28         scanf("%lld",&b[i]);
    29     sort(b+1,b+1+n);
    30     dp[n+1]=0;
    31     for(int i=n;i>=1;i--)
    32         dp[i]=max(dp[i+1],a[i]-i);
    33     ll ans=0;
    34     ll now=0;
    35     for(int i=n+1;i<=2*n;i++){
    36         ll zha=max(dp[b[i-n]],now);
    37         ans+=zha;
    38         ans%=mod;
    39         now=max(now,zha-i);
    40     }
    41     printf("%lld
    ",ans);
    42     }
    43     return 0;
    44 }

    HDU 6049

     1 #include <iostream>
     2 #include <cstdio>
     3 using namespace std;
     4 const int N=5010;
     5 int f[N][N],minN[N][N],maxN[N][N],last[N];
     6 int n,a[N];
     7 void work()
     8 {
     9     int i,j,k,ii,jj;
    10     for (i=1; i<=n; i++)
    11     {
    12         f[i][i]=1;
    13         last[i]=i;
    14         minN[i][i]=maxN[i][i]=a[i];
    15         for(j=i+1; j<=n; j++)
    16         {
    17             minN[i][j]=min(minN[i][j-1],a[j]);
    18             maxN[i][j]=max(maxN[i][j-1],a[j]);
    19         }
    20     }
    21     for(k=2; k<=n; k++)
    22         for(i=1; i<=n-k+1; i++)
    23         {
    24             j=i+k-1;
    25             if (maxN[i][j]-minN[i][j]!=j-i)
    26                 f[i][j]=0;
    27             else
    28             {
    29                 if (minN[i][j]<minN[i][last[i]])f[i][j]=1;
    30                 else
    31                     f[i][j]=f[i][last[i]]+f[last[i]+1][j];
    32                 last[i]=j;
    33             }
    34         }
    35     int ans=f[1][n];
    36     for (i=1; i<=n; i++)
    37         for (j=i; j<=n; j++)
    38             if (f[i][j]&&(i==1||f[1][i-1]&&minN[1][i-1]==1))
    39             {
    40                 jj=maxN[i][j];
    41                 if (jj==n||maxN[jj+1][n]==n&&f[jj+1][n])
    42                     for (ii=jj; ii>j; ii--)
    43                         if (f[ii][jj]&&minN[ii][jj]==i)
    44                             ans=max(ans,f[1][i-1]+f[j+1][ii-1]+f[jj+1][n]+2);
    45             }
    46     cout<<ans<<endl;
    47 }
    48 int main()
    49 {
    50     int T,i,j;
    51     cin>>T;
    52     for (i=1; i<=T; i++)
    53     {
    54         cin>>n;
    55         for (j=1; j<=n; j++)cin>>a[j];
    56         work();
    57     }
    58     return 0;
    59 }

    HDU 6055

     1 #pragma comment(linker, "/STACK:102400000,102400000")
     2 #include <cstdio>
     3 #include <iostream>
     4 #include <cstdlib>
     5 #include <cstring>
     6 #include <algorithm>
     7 #include <cmath>
     8 #include <cctype>
     9 #include <map>
    10 #include <set>
    11 #include <queue>
    12 #include <bitset>
    13 #include <string>
    14 #include <complex>
    15 #define ll long long
    16 #define mod 1000000007
    17 using namespace std;
    18 int n;
    19 struct node
    20 {
    21     int x,y;
    22 } N[505];
    23 int mp[505][505];
    24 int main()
    25 {
    26 
    27     while(scanf("%d",&n)!=EOF)
    28     {
    29         memset(mp,0,sizeof(mp));
    30         for(int i=1; i<=n; i++)
    31         {
    32             scanf("%d %d",&N[i].x,&N[i].y);
    33             mp[N[i].x+100][N[i].y+100]=1;
    34         }
    35         int ans=0;
    36         for(int i=1; i<=n; i++){
    37             for(int j=1; j<=n; j++){
    38                 if(i==j)
    39                     continue;
    40                 int x,y,xx,yy;
    41                 x=N[i].x;y=N[i].y;
    42                 xx=N[j].x;yy=N[j].y;
    43                 int x1,y1,x2,y2;
    44                 int x3,y3,x4,y4;
    45                 if((x>=xx&&y>yy)){
    46                 x1=xx+abs(y-yy)+abs(x-xx);
    47                 y1=y-abs(x-xx);
    48                 x2=xx+abs(y-yy);
    49                 y2=yy-abs(x-xx);
    50                 x3=x-abs(y-yy);
    51                 y3=y+abs(x-xx);
    52                 x4=x-abs(y-yy)-abs(x-xx);
    53                 y4=yy+abs(x-xx);
    54                 if(x1+100>=0&&y1+100>=0&&x2+100>=0&&y2+100>=0&&mp[x1+100][y1+100]&&mp[x2+100][y2+100]){
    55                     ans++;
    56                     }
    57                 if(x3+100>=0&&y3+100>=0&&x4+100>=0&&y4+100>=0&&mp[x3+100][y3+100]&&mp[x4+100][y4+100]){
    58                     ans++;
    59                 }
    60                 }
    61             }
    62             }
    63         printf("%d
    ",ans/2);
    64     }
    65     return 0;
    66 }
  • 相关阅读:
    SOM 的两种算法
    moco响应结果浏览器访问乱码
    moco的启动及第一个demo
    IDEA 解决 terminal 中文乱码
    moco框架的下载
    ExtentReport测试报告的使用
    testNG超时测试
    testNG 多线程测试(xml文件实现)
    testNG @DataProvider参数化
    testNG xml文件参数化
  • 原文地址:https://www.cnblogs.com/hsd-/p/7252998.html
Copyright © 2020-2023  润新知