QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#568787#9313. Make MaxyyhforgetCompile Error//C99813b2024-09-16 18:15:322024-09-16 18:15:32

Judging History

你现在查看的是最新测评结果

  • [2024-09-18 15:56:24]
  • hack成功,自动添加数据
  • (/hack/836)
  • [2024-09-16 18:15:32]
  • 评测
  • [2024-09-16 18:15:32]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sybc_with_stdio(false);cin.tie(0);cout(0);
#define endl "\n"
signed main() {
	int _;
	cin>>_;
	while(_--) {
		int n;
		cin>>n;
		stack<int>st;
		int ans=0;
		for(int i=0; i<n; i++) {
			int tmp;
			cin>>tmp;
			if(st.empty()) {
				st.push(tmp);
			} else {
				int ttmp=st.top(),js=1;
				st.pop();
				while(!st.empty()&&st.top()<tmp) {
					if(st.top()==ttmp) {
						js++;
					} else {
						ans+=js;
						ttmp=st.top();
						js++;
					}
					st.pop();
				}
				st.push(tmp);
			}
		}
		cout<<st.size()<<endl;
		int ttmp=st.top(),js=1;
		st.pop();
		while(!st.empty()) {
			if(st.top()!=ttmp) {
				ans+=js;
			}
			js++;
			st.pop();
		}
		cout<<ans<<endl;
	}
	return 0;
}

詳細信息

answer.code:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.