zoukankan      html  css  js  c++  java
  • BZOJ4580/Luogu3147 [Usaco2016 Open]248

    amazing

    #include <iostream>
    #include <cstdio>
    #include <cstring>
    #include <algorithm>
    #include <cmath>
    #define R(a,b,c) for(register int  a = (b); a <= (c); ++ a)
    #define nR(a,b,c) for(register int  a = (b); a >= (c); -- a)
    #define Max(a,b) ((a) > (b) ? (a) : (b))
    #define Min(a,b) ((a) < (b) ? (a) : (b))
    #define Fill(a,b) memset(a, b, sizeof(a))
    #define Swap(a,b) a^=b^=a^=b
    #define ll long long
    #define ON_DEBUG
    
    #ifdef ON_DEBUG
    
    #define D_e_Line printf("
    
    ----------
    
    ")
    #define D_e(x)  cout << #x << " = " << x << endl
    #define Pause() system("pause")
    
    #else
    
    #define D_e_Line ;
    
    #endif
    
    struct ios{
        template<typename ATP>ios& operator >> (ATP &x){
            x = 0; int f = 1; char c;
            for(c = getchar(); c < '0' || c > '9'; c = getchar()) if(c == '-')  f = -1;
            while(c >= '0' && c <= '9') x = x * 10 + (c ^ '0'), c = getchar();
            x*= f;
            return *this;
        }
    }io;
    using namespace std;
    
    const int N = 270007;
    
    int f[61][N];
    
    int main(){
    	int n;
        io >> n;
        int ans = 0;
        R(i,1,n){
            int x;
            io >> x;
            f[x][i] = i + 1;
            ans = Max(ans, x);
        }
        
        R(i,2,58)
            R(j,1,n){
                if(!f[i][j]) 
                    f[i][j] = f[i-1][f[i-1][j]];
                if(f[i][j]) 
                    ans = i;
            }
            
        printf("%d",ans);
        return 0;
    }
    

    normal

    #include <iostream>
    #include <cstdio>
    #include <cstring>
    #include <algorithm>
    #include <cmath>
    #define R(a,b,c) for(register int  a = (b); a <= (c); ++ a)
    #define nR(a,b,c) for(register int  a = (b); a >= (c); -- a)
    #define Max(a,b) ((a) > (b) ? (a) : (b))
    #define Min(a,b) ((a) < (b) ? (a) : (b))
    #define Fill(a,b) memset(a, b, sizeof(a))
    #define Swap(a,b) a^=b^=a^=b
    #define ll long long
    #define ON_DEBUG
    
    #ifdef ON_DEBUG
    
    #define D_e_Line printf("
    
    ----------
    
    ")
    #define D_e(x)  cout << #x << " = " << x << endl
    #define Pause() system("pause")
    
    #else
    
    #define D_e_Line ;
    
    #endif
    
    struct ios{
        template<typename ATP>ios& operator >> (ATP &x){
            x = 0; int f = 1; char c;
            for(c = getchar(); c < '0' || c > '9'; c = getchar()) if(c == '-')  f = -1;
            while(c >= '0' && c <= '9') x = x * 10 + (c ^ '0'), c = getchar();
            x*= f;
            return *this;
        }
    }io;
    using namespace std;
    
    const int N = 257;
    
    int f[N][N];
    
    int main(){
        int n;
        io >> n;
        int ans = 0;
        R(i,1,n){
            io >> f[i][i];
            ans = Max(ans, f[i][i]);
        }
        
        R(i,1,n){
            R(l,1,n-i+1){
                int r = l + i - 1;
                R(k,l,r-1){
                    if(f[l][k] == f[k+1][r]){
                        f[l][r] = Max(f[l][r], f[l][k] + 1);
                        ans = Max(ans, f[l][r]);
                    }
                }
            }
        }
        
        printf("%d", ans);
        
        return 0;
    }
    

  • 相关阅读:
    php&&页面静态化
    页面静态化处理-必须利用URL重写规则
    所有技术都是遵循最基本的原理
    技术就是一层窗户纸-于无声处看大神
    从大局着眼,从小事着手
    网站基本功-SQL注入基本介绍
    Win7下开启wifi热点少见的常用注意事项
    恶搞别人电脑输入百度网址出现搜狐的网站--关于Hosts文件一些运用
    关于windows下的dos和linux下的shell
    httpd_Vhosts文件的配置
  • 原文地址:https://www.cnblogs.com/bingoyes/p/11209707.html
Copyright © 2011-2022 走看看