제출 #916439

#제출 시각아이디문제언어결과실행 시간메모리
916439Jakub_Wozniak순열 (APIO22_perm)C++17
0 / 100
0 ms444 KiB
#include <bits/stdc++.h> using namespace std; vector <pair<int,int>> V; vector<int> construct_permutation(long long n) { if(n == 1)return {}; if(n == 2)return {0}; if(n == 3)return {1,0}; if(n == 4)return {0,1}; long long MAX = 300; vector <int> v; int B; int R = n%3; int r[200]; n /= 3; if(R)v.push_back(R); while (n) { if(n < 4) { if(n < 2)break; if (n % 4 == 3) v.push_back(1); v.push_back(MAX); MAX--; break; } if (n % 4 == 1) v.push_back(1); if (n % 4 == 3) v.push_back(3); v.push_back(MAX); MAX--; if (n % 4 == 2) v.push_back(1); v.push_back(MAX); MAX--; n /= 4; } v.push_back(1); v.push_back(2); reverse(v.begin() , v.end()); for(int i = 0 ; i < v.size() ; i++) { V.push_back({v[i],-i}); } sort(V.begin() , V.end()); long long 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:52:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |     for(int i = 0 ; i < v.size() ; i++)
      |                     ~~^~~~~~~~~~
perm.cpp:59: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]
   59 |     for(int i = 0 ; i < V.size() ;i++)
      |                     ~~^~~~~~~~~~
perm.cpp:66: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]
   66 |     for(int i = 0 ; i < V.size() ; i++)
      |                     ~~^~~~~~~~~~
perm.cpp:15:9: warning: unused variable 'B' [-Wunused-variable]
   15 |     int B;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...