Submission #862231

# Submission time Handle Problem Language Result Execution time Memory
862231 2023-10-17T19:08:07 Z Ahmed_Solyman Volontiranje (COCI21_volontiranje) C++14
0 / 110
2 ms 344 KB
/*
In the name of Allah
made by: Ahmed_Solyman
*/
#include <bits/stdc++.h>
#include <ext/rope>
 
using namespace std;
using namespace __gnu_cxx;
#pragma GCC optimize("-Ofast")
#pragma GCC optimize("-O1")
//-------------------------------------------------------------//
typedef long long ll;
typedef unsigned long long ull;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI acos(-1)
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define sum_to(n) (n*(n+1))/2
#define pb push_back
#define pf push_front
#define fil(arr,x) memset(arr,x,sizeof(arr))
const ll mod=1e9+7;
int dx[8]={0,1,0,-1,1,1,-1,-1};
int dy[8]={1,0,-1,0,1,-1,-1,1};
//-------------------------------------------------------------//
ll lcm(ll a,ll b)
{
    return (max(a,b)/__gcd(a,b))*min(a,b);
}
void person_bool(bool x)
{
    cout<<(x?"YES":"NO")<<endl;
}
map<int,bool>vis;
vector<int> LIS(vector<int>arr){
	vector<int>v;
	for(auto i:arr){
		if(vis[i])continue;
		if(!v.size()){
			v.push_back(i);
		}
		else{
			if(v.back()<i){
				v.push_back(i);
			}
			else{
				v[(ub(all(v),i)-v.begin())]=i;
			}
		}
	}
	for(auto i:v)vis[i]=1;
	return v;
}
void run(){
    #ifndef ONLINE_JUDGE
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
    #endif
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    fast
    run();
    int n;cin>>n;
    vector<int>arr(n);
    map<int,int>mp;
    int j=1;
    for(auto &i:arr)cin>>i,mp[i]=j++;
    int lis=LIS(arr).size();
	for(auto i:arr)vis[i]=0;
	int cnt=0;
	vector<vector<int>>ans;
	while(1){
		vector<int>v=LIS(arr);
		if(v.size()==lis){
			cnt++;
			ans.push_back(v);
		}
		else{
			break;
		}
	}
	cout<<cnt<<" "<<lis<<endl;
	for(auto i:ans){
		vector<int>v;
		for(auto j:i)v.push_back(mp[j]);
		sort(all(v));
		for(auto j:v)cout<<j<<" ";
		cout<<endl;
	}
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:81:14: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   81 |   if(v.size()==lis){
      |      ~~~~~~~~^~~~~
Main.cpp: In function 'void run()':
Main.cpp:60:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   60 |     freopen("input.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:61:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   61 |     freopen("output.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -