제출 #740864

#제출 시각아이디문제언어결과실행 시간메모리
740864enerelt14Permutation (APIO22_perm)C++17
0 / 100
1 ms340 KiB
#include "perm.h"
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
vector<int> x;
vector<int> construct_permutation(ll k){
	if (k == 1)return {};
	if (k == 2)return {0};
	if (k == 3)return {1, 0};
	if (k % 4 == 0){
		x = construct_permutation(k / 4);
		x.pb(x.size());
		x.pb(x.size());
		return x;
	}
	if (k % 4 == 1){
		x = construct_permutation(k / 4);
		for (int i = 0; i < x.size(); i++)x[i]++;
		x.pb(x.size() + 1);
		x.pb(x.size() + 1);
		x.pb(0);
		return x;
	}
	if (k % 4 == 2){
		x = construct_permutation(k / 4);
		for (int i = 0; i < x.size(); i++)x[i]++;
		x.pb(x.size() + 1);
		x.pb(0);
		x.pb(x.size());
		return x;
	}
	x = construct_permutation(k / 4);
	for (int i = 0; i < x.size(); i++)x[i] += 2;
	x.pb(1);
	x.pb(x.size() + 1);
	x.pb(0);
	x.pb(x.size());
	return x;
}

컴파일 시 표준 에러 (stderr) 메시지

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:19:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   for (int i = 0; i < x.size(); i++)x[i]++;
      |                   ~~^~~~~~~~~~
perm.cpp:27:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   for (int i = 0; i < x.size(); i++)x[i]++;
      |                   ~~^~~~~~~~~~
perm.cpp:34:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |  for (int i = 0; i < x.size(); i++)x[i] += 2;
      |                  ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...