제출 #1049133

#제출 시각아이디문제언어결과실행 시간메모리
1049133Marco_Escandon순열 (APIO22_perm)C++17
91.33 / 100
3 ms492 KiB
//#include "perm.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; std::vector<int> construct_permutation(long long k) { vector<int> cad; for(int i=0; i<64; i++) { cad.push_back(i); } ll k2=k; ll p=64; ll pl=0; for(ll i=60; i>-1; i--) { if((k&(1LL<<i))!=0) { vector<int> cad2; ll asdf=0; for(int j=0; asdf<i-1+pl; j++) { if(cad[j]==asdf) asdf++; cad2.push_back(cad[j]); } cad2.push_back(p++); for(int j=asdf; j<cad.size(); j++) { cad2.push_back(cad[j]); } cad=cad2; pl=1; } } while(cad.size()>0&&cad.back()!=64) cad.pop_back(); vector<int> asd=cad;map<ll,ll> mapa;sort(asd.begin(),asd.end()); ll c=1; for(auto i:asd) if(mapa[i]==0)mapa[i]=c++; for(int i=0; i<cad.size(); i++) cad[i]=mapa[cad[i]]-1; return cad; }

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

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:28:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |    for(int j=asdf; j<cad.size(); j++)
      |                    ~^~~~~~~~~~~
perm.cpp:41:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |  for(int i=0; i<cad.size(); i++)
      |               ~^~~~~~~~~~~
perm.cpp:12:5: warning: unused variable 'k2' [-Wunused-variable]
   12 |  ll k2=k;
      |     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...