- 难解的问题
 - @ 2013-11-01 19:36:50
 
测试数据 #0: WrongAnswer, time = 281 ms, mem = 560 KiB, score = 0
测试数据 #1: WrongAnswer, time = 15 ms, mem = 564 KiB, score = 0
测试数据 #2: Accepted, time = 15 ms, mem = 564 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 560 KiB, score = 10
测试数据 #4: Accepted, time = 31 ms, mem = 588 KiB, score = 10
测试数据 #5: Accepted, time = 15 ms, mem = 636 KiB, score = 10
测试数据 #6: Accepted, time = 31 ms, mem = 556 KiB, score = 10
测试数据 #7: WrongAnswer, time = 875 ms, mem = 1388 KiB, score = 0
测试数据 #8: Accepted, time = 140 ms, mem = 768 KiB, score = 10
测试数据 #9: WrongAnswer, time = 921 ms, mem = 1184 KiB, score = 0
WrongAnswer, time = 2324 ms, mem = 1388 KiB, score = 60
#include<iostream>
#include<cstdio>
#include<deque>
using namespace std;
struct node{
    int num,data;
    friend bool operator<=(node a,node b)
    {
        return a.data<=b.data;
    }
};
int main()
{
    deque<node>q;
    int n,k;
    cin>>n>>k;
    int maxi=-1;
    bool inque=false;
    for(int i=1;i<=n;i++){
        int g;
        cin>>g;
        node pp;
        pp.num=i;
        pp.data=g;
        if(i==k)inque=true;
        while(!q.empty() && pp<=q.back()){
            node jj=q.back();
            if(jj.num==k)inque=false;
            q.pop_back();
        }
        q.push_back(pp);
        if(inque){
            int u=q.size();
            if(maxi<u)maxi=u;
        }
    }
    cout<<maxi<<endl;
    return 0;
}
1 条评论
- 
  华好少年 LV 8 @ 2013-11-05 19:49:20
因为你错了
 
- 1