Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
52727 纪思辰 木薯与身高 C++ 解答错误 30 171 MS 8792 KB 447 2022-07-20 11:51:15

Tests(6/20):


#include <bits/stdc++.h> using namespace std; deque<pair<int,int> >q,qq; int ans = 0,n; main(){ scanf("%d",&n); for (int i=1;i<=n;i++){; int x; scanf("%d",&x); while (!q.empty()&&q.front().first<=x) { qq.push_back(q.front()); q.pop_front(); } q.push_back(make_pair(x,i)); ans+=(i-q.front().second); while(!qq.empty()){ q.push_front(qq.back()); qq.pop_back(); } } printf("%d",ans); return 0; }


测评信息: