제출 #916435

#제출 시각아이디문제언어결과실행 시간메모리
916435Jakub_Wozniak순열 (APIO22_perm)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; vector <pair<int,int>> V; vector<int> construct_permutation(long long n) { long long MAX = 300; vector <int> v; vector <bool> 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:47:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |     for(int i = 0 ; i < v.size() ; i++)
      |                     ~~^~~~~~~~~~
perm.cpp:54: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]
   54 |     for(int i = 0 ; i < V.size() ;i++)
      |                     ~~^~~~~~~~~~
perm.cpp:61: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]
   61 |     for(int i = 0 ; i < V.size() ; i++)
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...