Submission #984091

# Submission time Handle Problem Language Result Execution time Memory
984091 2024-05-16T10:01:23 Z Izaz Permutation (APIO22_perm) C++17
0 / 100
1000 ms 416 KB
#include <bits/stdc++.h>
using namespace std;

#define f first
#define s second
#define mn(a,b) min(a,b)
#define mx(a,b) max(a,b)
#define ll long long
vector<int> construct_permutation(long long  k)
{
	int K = k;
	vector<int>AL;
	for(int i = 0 ; i < 9;i ++ ){
		AL.push_back(i);
		vector<int>Z  = AL;
		int yes = 0;
		do{
			int N = AL.size();
			int Cnt = 1 ;
			for(int i = 1 ; i < (1<< N); i ++){
				bool P = 1;
				int last = - 1;
				for(int j = 0 ; j < N;j++){
					if((1<<j)&i){
						if(last > Z[j]){
							P =0;
							break;
						}
						last = Z[j];
					}
				}
				if(P)Cnt++;
			}
			
			if(Cnt == K){
				yes = 1;
				break;
			}
		
		}while(next_permutation(Z.begin(),Z.end()));
		if(yes){
			return Z;
		}
	}
	return {0};
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Execution timed out 1072 ms 416 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Execution timed out 1072 ms 416 KB Time limit exceeded
3 Halted 0 ms 0 KB -