제출 #313011

#제출 시각아이디문제언어결과실행 시간메모리
313011hackermubArranging Shoes (IOI19_shoes)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "shoes.h" using namespace std; #include<bits/stdc++.h> using namespace std; #define int long long #define pii pair<int,int> #define fi first #define se second #define pb push_back #define all(v) v.begin(),v.end() #define sz(v) (int)v.size() #define uid uniform_int_distribution<int> //mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); const int MOD = 1e9+7; const int64_t INF = 1e18; const int MAXN = 2e5+7; int N; vector<int> tree(MAXN); void update(int idx,int val=1){ while(idx<=N){ tree[idx]+=val; idx+=idx&(-idx); } } int read(int idx){ int sum=0; while(idx>0){ sum+=tree[idx]; idx-=idx&(-idx); } return sum; } int query(int L,int R){ return read(R)-read(L-1); } long long count_swaps(std::vector<int> s) { N=s.size(); int n=N/2; queue<int> idx[2*n+1]; for(int i=0;i<2*n;i++){ //cout<<s[i]+n<<" "; idx[s[i]+n].push(i+1); } vector<int> perm; vector<bool> vis(2*n+1); for(int i=0;i<2*n;i++)if(!vis[i]){ if(s[i]<0){ perm.pb(i+1); vis[i]=1; perm.pb(idx[-s[i]+n].front()); idx[-s[i]+n].pop(); vis[perm.back()-1]=1; }else{ perm.pb(idx[-s[i]+n].front()); idx[-s[i]+n].pop(); vis[perm.back()-1]=1; perm.pb(i+1); vis[i]=1; } idx[s[i]+n].pop(); } int ans=0; for(auto x:perm){ ans+=query(x+1,N); update(x); } return ans; } #ifdef OFFLINE int32_t main(){ ios_base::sync_with_stdio(false);cin.tie(); //If you hack my code , You are gay int n; cin>>n; vector<int> s(2*n); for(int i=0;i<2*n;i++){ cin>>s[i]; } cout<<count_swaps(s); return 0; } #endif #undef int

컴파일 시 표준 에러 (stderr) 메시지

/tmp/cc7Z0s2U.o: In function `main':
grader.cpp:(.text.startup+0x27a): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status