Submission #714368

#TimeUsernameProblemLanguageResultExecution timeMemory
714368SwanPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <stack> #include <algorithm> #include <string> #include <set> #include <map> #include <list> #include <time.h> #include <math.h> #include <random> #include <deque> #include <queue> #include <cassert> #include <unordered_map> #include <unordered_set> #include <iomanip> #include <bitset> #include <sstream> #include <chrono> #include <cstring> //#define int long long #define INP freopen("palpath.in","r",stdin) #define OUTP freopen("palpath.out","w",stdout) using ld = long double; using LD = ld; using namespace std; bitset<64> getBits(long long x) { int pnt = 0; bitset<64> res; while(x) { res[pnt++] = x%2; x/=2; } return res; } vector<int> construct_permutation(long long k) { bitset<64> bits (k); int mx = 0; for (int i = 0; i < 64; i++) { if (bits[i]) { mx = i; } } vector<int> res; for (int i = 0; i < mx; i++) { res.push_back(i); } for (int i = mx - 1; i >= 0; i--) { if (!bits[i]) { continue; } for (int j = 0; j < res.size(); j++) { if(res[j] >= i) { res[j]++; } } res.push_back(i); } return res; } int main(){ ios_base::sync_with_stdio(0); /* int k; cin >> k; vector<int> kek = construct_permutation(k); for (int i = 0; i < kek.size(); i++) { cout << kek[i] << ' '; } cout << endl; check(kek);*/ return 0; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:56:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |         for (int j = 0; j < res.size(); j++) {
      |                         ~~^~~~~~~~~~~~
/usr/bin/ld: /tmp/ccvUXhrA.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccCfRpcz.o:perm.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status