Submission #932787

#TimeUsernameProblemLanguageResultExecution timeMemory
9327878pete8Permutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include<iostream> #include<stack> #include<map> #include<vector> #include<string> #include<unordered_map> #include <queue> #include "perm.h" #include<cstring> #include<cassert> #include<limits.h> #include<cmath> #include<set> #include<numeric> //gcd(a,b) #include<algorithm> #include<bitset> #include<stack> using namespace std; #define ll long long #define f first #define endl "\n" #define s second #define pii pair<int,int> #define pppiiii pair<pii,pii> #define ppii pair<int,pii> #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define fastio ios::sync_with_stdio(false);cin.tie(NULL); #pragma GCC optimize ("03,unroll-loops") //#define int long long //const int mod=1e9+7,mxn=2e5,lg=30,inf=1e18,minf=-1e18,Mxn=2e6,root=700; void setIO(string name){ ios_base::sync_with_stdio(0); cin.tie(0); freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } bool cmp(pii a,pii b){ if(a.f!=b.f)return a.f<b.f; return a.s>b.s; } vector<int> construct_permutation(int64_t k){ vector<pii>ans; vector<int>ra; int g=0; for(int i=62;i>=0;i--)if(k&(1ll<<i)){ g=i; break; } int cnt=g-1; for(int i=0;i<g;i++)ans.pb({i,i}); for(int i=g-1;i>=0;i--){ if(k&(1ll<<i))ans.pb({i,++cnt}); } sort(all(ans),cmp); for(auto i:ans)ra.pb(i.s); return ra; }

Compilation message (stderr)

perm.cpp: In function 'void setIO(std::string)':
perm.cpp:38:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |  freopen((name+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
perm.cpp:39:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |  freopen((name+".out").c_str(),"w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccT3Rj7q.o: in function `main':
grader.cpp:(.text.startup+0x240): undefined reference to `construct_permutation(long long)'
collect2: error: ld returned 1 exit status