zoukankan      html  css  js  c++  java
  • CodeForces 740C Alyona and mex

    构造。

    比较骚的构造题。肯定可以构造出$min(R-L+1)$,只要$0$ $1$ $2$ $...$ $R-L$ $0$ $1$ $2$ $...$ $R-L$填数字即可,这样任意一段区间都包含了$0$ $1$ $2$ $...$ $R-L$。

    #pragma comment(linker, "/STACK:1024000000,1024000000")
    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    #include<vector>
    #include<map>
    #include<set>
    #include<queue>
    #include<stack>
    #include<ctime>
    #include<iostream>
    using namespace std;
    typedef long long LL;
    const double pi=acos(-1.0);
    void File()
    {
        freopen("D:\in.txt","r",stdin);
        freopen("D:\out.txt","w",stdout);
    }
    template <class T>
    inline void read(T &x)
    {
        char c = getchar();
        x = 0;
        while(!isdigit(c)) c = getchar();
        while(isdigit(c))
        {
            x = x * 10 + c - '0';
            c = getchar();
        }
    }
    
    int n,m;
    
    int main()
    {
        cin>>n>>m; int len=600000;
        for(int i=1;i<=m;i++)
        {
            int L,R; cin>>L>>R;
            len=min(len,R-L+1);
        }
    
        cout<<len<<endl;
        for(int i=0;i<n;i++)
        {
            cout<<(i+len-1)%len<<" ";
        }
        cout<<endl;
        return 0;
    }
  • 相关阅读:
    数据解压
    子区域数据合并
    数据压缩复制
    将Win10变回Win7/WinXP界面
    通过GP加载卫星云图-雷达图-降雨预报图
    Maven版本与JDK版本
    由输入法随想
    selinux开关
    android studio 配置
    NodeJS 笔记
  • 原文地址:https://www.cnblogs.com/zufezzt/p/6397078.html
Copyright © 2011-2022 走看看