Блог пользователя aneee

Автор aneee, история, 6 лет назад, По-английски

Problem.

I solved the problem with three pointers. But when I sort the vectors first and the resize, I get an AC. If I sort them after making them unique, I get a WA.

AC Code
WA Code
  • Проголосовать: нравится
  • -14
  • Проголосовать: не нравится

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +47 Проголосовать: не нравится

Unique requires the vector to be sorted. All it does is check if adjacent elements are equal.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +31 Проголосовать: не нравится

unique only causes consecutive groups of identical elements to be condensed. So you need to sort first.