제출 #1314261

#제출 시각아이디문제언어결과실행 시간메모리
1314261haithamcoderArranging Shoes (IOI19_shoes)C++20
컴파일 에러
0 ms0 KiB
#include "shoes.h" using namespace std; #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> typedef long long ll; using namespace __gnu_pbds; typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > ordered_set; long long count_swaps(std::vector<int> a) { ll n = a.size() / 2; map<ll, ll> mp; for (ll i = 0; i < 2 * n; i++) { mp[a[i]] = i; } ordered_set s; for (ll i = 0; i < 2 * n; i++) { s.insert(i); } ll res = 0; while (s.size()) { auto x = *s.begin(); ll sz = a[x]; ll other = mp[-sz]; res += s.order_of_key(other) - (sz < 0); s.erase(mp[sz]); s.erase(mp[-sz]); } return res; } int main() { int n; assert(1 == scanf("%d", &n)); vector<int> S(2 * n); for (int i = 0; i < 2 * n; i++) assert(1 == scanf("%d", &S[i])); fclose(stdin); long long result = count_swaps(S); printf("%lld\n", result); fclose(stdout); return 0; }

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

/usr/bin/ld: /tmp/cclEStZ4.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc0vcniQ.o:shoes.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status