Submission #911398

#TimeUsernameProblemLanguageResultExecution timeMemory
911398asdasdqwerPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int int64_t vector<int32_t> construct_permutation(int64_t x) { if (x==2) { return {1}; } x--; vector<int32_t> out; __uint128_t ONE=1; int cnt=0; vector<int> v; for (int i=65;i>0;i--) { while (x >= (((ONE<<i)-1))) { v.push_back(i); x -= ((ONE<<i)-1); } } for (int i=1;i<=v.size();i++) { int start=(1e9-1e5)/i; for (int j=0;j<v[i-1];j++) { out.push_back(start+j); } } vector<int32_t> al=out; sort(al.begin(),al.end()); map<int,int> mp; for (int i=0;i<al.size();i++) { mp[al[i]]=i; } for (int32_t &x:out) { x = mp[x]; } return out; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(int64_t)':
perm.cpp:19:18: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and '__int128 unsigned' [-Wsign-compare]
   19 |         while (x >= (((ONE<<i)-1))) {
      |                ~~^~~~~~~~~~~~~~~~~
perm.cpp:25:19: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'std::vector<long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for (int i=1;i<=v.size();i++) {
      |                  ~^~~~~~~~~~
perm.cpp:36:19: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for (int i=0;i<al.size();i++) {
      |                  ~^~~~~~~~~~
perm.cpp:16:9: warning: unused variable 'cnt' [-Wunused-variable]
   16 |     int cnt=0;
      |         ^~~
/usr/bin/ld: /tmp/ccWLpiAT.o: in function `main':
grader.cpp:(.text.startup+0x240): undefined reference to `construct_permutation(long long)'
collect2: error: ld returned 1 exit status