Submission #1197336

#TimeUsernameProblemLanguageResultExecution timeMemory
1197336sodbayrPermutation (APIO22_perm)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "perm.h"
#define ll int
#define ss second
#define ff first
#define pb push_back
#define endl "\n"
using namespace std;
	vector<ll> construct_permutation(ll n){
		ll t=0;
		vector<ll> v;
		for(ll i=59;i>=0;i--){
			if(n>>i&1){
				if(t==0){
					t=1;
					ll ss=1;
					for(ll j=1;j<=i;j++){
						v.pb(ss);
						ss+=100;
					}
				}
				else{
					v.pb(v[i]-1);
				}
			}
		}
		map<ll,ll> mp;
		for(ll w : v){
			mp[i]=1;
		}
		ll b=0;
		for(auto w : mp){
			mp[w.ff]=b++;
		}
		for(ll &w : v){
			w=mp[i];
		}
		return v;
	}
/*int main(){
	ios::sync_with_stdio(false);
	cout.tie(0);
	cin.tie(0);
	ll n;cin>>n;
	vector<ll> a(n);
	a=construct_permutation(n);
	for(ll i=1;i<=n;i++){
		cout<<a[i]<<' ';
	}
}*/

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(int)':
perm.cpp:29:28: error: 'i' was not declared in this scope
   29 |                         mp[i]=1;
      |                            ^
perm.cpp:36:30: error: 'i' was not declared in this scope
   36 |                         w=mp[i];
      |                              ^