shashack's blog

By shashack, history, 4 years ago, In English

I tried to solve this problem today (https://codeforces.com/contest/1311/problem/F), but I got the error message below. I don't know what the error means.

Code (https://codeforces.com/contest/1311/submission/72003392)

Problem => int vz = unique(v.begin(), v.end()) — v.begin();

*I just changed the 76th line like below, then my code got accepted it.

unique(v.begin(), v.end());
int vz = v.end() - v.begin(); or v.size();

I think the codes above are equivalent. Why does the error happen?

[Error]

Diagnostics detected issues [cpp.g++17-drmemory]: Dr,2020-02-28.M Dr. Memory version 1.11.0 Dr,2020-02-28.M Running "program.exe"

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. C:/Programs/mingw-w64-7/lib/gcc/i686-w64-mingw32/7.3.0/include/c++/bits/stl_algobase.h:991: Error: elements in iterator range [__first, __last) are not partitioned by the value __val.

Objects involved in the operation: iterator "__first" @ 0x114FFE5C { type = gnu_debug::_Safe_iterator<gnu_cxx::__normal_iterator<long long*, std::__cxx1998::vector<long long, std::allocator > >, std::__debug::vector<long long, std::allocator > > (mutable iterator); state = dereferenceable (start-of-sequence); references sequence with type 'std::__debug::vector<long long, std::allocator >' @ 0x114FFD48 } iterator "__last" @ 0x114FFE48 { type = gnu_debug::_Safe_iterator<gnu_cxx::__normal_iterator<long long*, std::__cxx1998::vector<long long, std::allocator > >, std::__debug::vector<long long, std::allocator > > (mutable iterator); state = past-the-end; references sequence with type 'std::__debug::vector<long long, std::allocator >' @ 0x114FFD48 }

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it