제출 #249174

#제출 시각아이디문제언어결과실행 시간메모리
249174Dilshod_ImomovArranging Shoes (IOI19_shoes)C++17
컴파일 에러
0 ms0 KiB
# include <bits/stdc++.h> using namespace std; long long count_swaps( vector < long long > s ) { long long n = (long long )s.size(), ans = 0, sz = 0; vector < long long > ids, used(n); map < long long , vector < long long > > vc; for ( long long i = 0; i < n; i++ ) { vc[s[i]].push_back( i ); } // cout << "Done 1" << endl; for ( long long i = 0; i < n; i++ ) { if ( used[i] ) { continue; } long long l = i, r = *vc[-s[i]].begin(); // cout << "Done 2 " << l << ' ' << r << '\n'; vc[ s[i] ].erase( vc[ s[i] ].begin() ); long long rr = r; used[r] = 1; vc[-s[i]].erase( vc[-s[i]].begin() ); long long x = upper_bound( ids.begin(), ids.end(), i ) - ids.begin(); x = sz - x; l += x; x = upper_bound( ids.begin(), ids.end(), r ) - ids.begin(); x = sz - x; r += x; ans += r - l - 1; if ( s[i] > 0 ) { ans++; } sz++; ids.push_back( rr ); } return ans; } /* int main() { long long n; cin >> n; vector < long long > S(2 * n); for ( long long i = 0; i < 2 * n; i++ ) { cin >> S[i]; } // cout << count_swaps( S ); }*/

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

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