召唤dalao!拯救蒟蒻的40分辣鸡代码qwq

P1983 [NOIP2013 普及组] 车站分级

 Lzr @ 2019-08-07 09:41:56

#include<bits/stdc++.h>
using namespace std;

int n,m,t,tk,Le[1010],gminn,minn = 99999;
bool F[1010]; //第i辆车是否过j点 

int main(){
    //freopen("testdata.txt","r",stdin);
    scanf("%d%d",&n,&m);

    for(int j = 1;j <= n;++j)
        Le[j] = 99999;

    for(int i = 1;i <= m;++i){
        memset(F,0,sizeof(F));
        scanf("%d",&t);
        gminn = 99999;

        for(int k = 1;k <= t;++k){
            scanf("%d",&tk);
            F[tk] = 1;
            gminn = min(Le[tk],gminn);
        }
        for(int j = 1;j <= n;++j)
            if(!F[j])
                Le[j] = gminn - 1;
    }
    for(int j = 1;j <= n;++j)
        minn = min(minn,Le[j]);
    printf("%d",100000 - minn);
}

觉得这个思路比较清奇辣鸡,就是每次输入完一个车次的停靠站后,将其他站的值赋为这些停靠站 的最小值再减一,最后输出100000 - minn得出答案www


by  Lzr @ 2019-08-07 09:44:37

奇妙得分


by  Lzr @ 2019-08-07 09:47:04

@MOONPIE dalao快来


by  Lzr @ 2019-08-07 09:49:04

第二个样例本该输出14的,这里输出998……? 还热乎的蒟蒻,不要99999998,只要998,白天%%%,晚上%%%……?


by Elzat @ 2019-08-07 09:51:38

好玄学的做法。。


by  Lzr @ 2019-08-07 09:52:09

@Elzat 日常玄学但没什么用的做法qwq


by MoonPie @ 2019-08-07 09:57:06

沃是蒟蒻


by  Lzr @ 2019-08-07 09:57:11

好了大家当看看热闹吧,蒟蒻没读懂题qwq


by  Lzr @ 2019-08-07 09:58:28

@MOONPIE 鸡您太强!


by  Lzr @ 2019-08-07 10:20:55

#include<bits/stdc++.h>
using namespace std;

int n,m,t,tk,Le[1010],gminn,minn = 99999,fir,end,maxn;
bool F[1010]; //第i辆车是否过j点 

int main(){
    //freopen("testdata.txt","r",stdin);
    scanf("%d%d",&n,&m);

    for(int j = 1;j <= n;++j)
        Le[j] = 99999;

    for(int i = 1;i <= m;++i){
        memset(F,0,sizeof(F));
        scanf("%d",&t);
        gminn = 99999;

        for(int k = 1;k <= t;++k){
            scanf("%d",&tk);
            F[tk] = 1;
            gminn = min(Le[tk],gminn);
            if(k == 1)
                fir = tk;
            if(k == t)
                end = tk;
        }
        /*for(int j = 1;j <= n;++j)
            if(j < fir || j > end)
                Le[j] = gminn - 1;*/
        for(int j = fir + 1;j < end;++j)
            if(!F[j]) 
                Le[j] = gminn - 1;
    }

    for(int j = 1;j <= n;++j)
        minn = min(minn,Le[j]),maxn = max(maxn,Le[j]);
    printf("%d",maxn - minn + 1);
}

改了一遍代码,现在爆零了:)


|