제출 #916402

#제출 시각아이디문제언어결과실행 시간메모리
916402Jakub_Wozniak순열 (APIO22_perm)C++17
91.33 / 100
2 ms436 KiB
#include <bits/stdc++.h> using namespace std; vector <pair<int,int>> V; vector<int> construct_permutation(long long n) { long long akt = 200; vector <int> v; int r[200]; while (n) { if (n == 1) break; if (n % 2) { v.push_back(0); } v.push_back(akt); n /= 2; akt--; } reverse(v.begin() , v.end()); for(int i = 0 ; i < v.size() ; i++) { V.push_back({v[i],-i}); } sort(V.begin() , V.end()); akt = 0; for(int i = 0 ; i < V.size() ;i++) { r[-V[i].second] = akt; akt++; } for(int i = 0 ; i < V.size() ; i++) { v[i] = r[i]; } V.clear(); return v; }

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

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:27:23: 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 < v.size() ; i++)
      |                     ~~^~~~~~~~~~
perm.cpp:34:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(int i = 0 ; i < V.size() ;i++)
      |                     ~~^~~~~~~~~~
perm.cpp:41:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for(int i = 0 ; i < V.size() ; i++)
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...