제출 #677047

#제출 시각아이디문제언어결과실행 시간메모리
677047hello_there_123Arranging Shoes (IOI19_shoes)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "shoes.h" using namespace std; #define int long long int n; int ft[100005]; inline int ls(int x){return x & -x; } int qry(int p){ p++; if(p<1) return 0; int r = 0; for(;p;p-=ls(p)) r+=ft[p]; return r; } void upd(int p, int v){ p++; for(;p<=n;p+=ls(p)) ft[p]+=v; } long long count_swaps(vector<int>s) { int ans = 0; n = s.size(); map<int,queue<int> >mp; for(int i=0;i<n;i++){ int x = s[i]; mp[x].push(i); } bool arr[n+3]; memset(arr,0,sizeof(arr)); for(int i=0;i<n;i++){ mp[s[i]].pop(); if(arr[i]) continue; int first = mp[-s[i]].front(); mp[-arr[i]].pop(); ans+=first-i-1-(qry(first)-qry(i-1)); upd(first,1); arr[first] = 1; if(s[i]>0) ans++; } return ans; }

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

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