205352026-01-07 17:38:40mikloshunorKéséscpp17Compilation error
#include <iostream>
#include <vector>
#include <set>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> v(n);
    set <int> t;
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
        t.insert(v[i]);
    }
    while (!t.empty)
    {
        if (t.count(v[i]))
        {
            t.erase(v[i]);
        }
        i--;
    }
    cout << i+2;
    return 0;
}
Compilation error
open /var/local/lib/isolate/405/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:17:15: error: cannot convert 'std::set<int>::empty' from type 'bool (std::set<int>::)() const noexcept' to type 'bool'
   17 |     while (!t.empty)
      |               ^~~~~
main.cpp:17:15: error: in argument to unary !
   17 |     while (!t.empty)
      |             ~~^~~~~
main.cpp:19:23: error: 'i' was not declared in this scope
   19 |         if (t.count(v[i]))
      |                       ^
main.cpp:23:9: error: 'i' was not declared in this scope
   23 |         i--;
      |         ^
main.cpp:25:13: error: 'i' was not declared in this scope
   25 |     cout << i+2;
      |             ^