Submission #535630

# Submission time Handle Problem Language Result Execution time Memory
535630 2022-03-10T17:49:37 Z inksamurai Volontiranje (COCI21_volontiranje) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rng(i,x,n) for(int i=x;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define vec(...) vector<__VA_ARGS__>
#define _3HspL4A ios::sync_with_stdio(0),cin.tie(0)
typedef long long ll;
using pii=pair<int,int>;
using vi=vec(int);
void print(){cout<<"\n";}
template<class T,class...E>
void print(const T&v,const E&...u){cout<<v<<' ',print(u...);}
// e 

pii op(pii l,pii r){
	if(l.fi!=r.fi) return l.fi>r.fi?l:r;
	return l.se>r.se?l:r;
}
pii e(){
	return {0,-1};
}

signed main(){
_3HspL4A;
	int n;
	cin>>n;
	vi a(n),id(n);
	rep(i,n){
		cin>>a[i];
		a[i]-=1;
		id[a[i]]=i;
	}
	set<int> st;
	for(auto x:a){
		if(!sz(st)){
			st.insert(x);
		}else{
			auto it=st.lower_bound(x);
			if(it!=st.end()){
				st.erase(it);
			}
			st.insert(x);
		}
	}
	int len=sz(st);
	st.clear();
	atcoder::segtree<pii,op,e> seg(n);
	vi dp(n);
	vec(vi) pns;
	rep(i,n){
		int x=a[i];
		pii p=seg.prod(0,x);
		dp[i]=p.se;
		seg.set(x,{p.fi+1,x});
		if(p.fi+1==len){
			int j=i,cnt=1;
			pns.pb({j});
			while(1){
				int nj=dp[j];
				if(nj==-1) break;
				cnt++;
				pns.back().pb(nj);
				dp[j]=-1;
				j=nj;
			}
			if(cnt<len) pns.back().clear();
		}
	}
	print(sz(pns));
	for(auto vq:pns){
		reverse(vq.begin(),vq.end());
		for(auto v:vq){
			cout<<v+1<<" ";
		}
		print();
	}
//	
	return 0;
}

Compilation message

Main.cpp:2:10: fatal error: atcoder/all: No such file or directory
    2 | #include <atcoder/all>
      |          ^~~~~~~~~~~~~
compilation terminated.