Borderou de evaluare (job #2612981)
Utilizator | Data | 9 mai 2020 14:09:39 | |
---|---|---|---|
Problema | Ordonare | Status | done |
Runda | Concurs de incalzire 2020 | Compilator | cpp-64 | Vezi sursa |
Scor | 0 |
Raport evaluator
Eroare de compilare:
main.cpp: In function 'int main()':
main.cpp:31:13: error: 'nxt' was not declared in this scope
while(f[nxt] == true) ++nxt;
^~~
main.cpp:34:13: error: 'nxt' was not declared in this scope
nxt = a[i] + 1;
^~~
main.cpp:36:27: error: overloaded function with no contextual type information
prev = a[i] - 1;
^
main.cpp:37:20: error: no match for 'operator[]' (operand types are 'std::unordered_map<int, bool>' and '<unresolved overloaded function type>')
while(f[prev] == true) --prev;
^
In file included from /usr/include/c++/6/unordered_map:48:0,
from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:117,
from main.cpp:1:
/usr/include/c++/6/bits/unordered_map.h:903:7: note: candidate: std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type&) [with _Key = int; _Tp = bool; _Hash = std::hash<int>; _Pred = std::equal_to<int>; _Alloc = std::allocator<std::pair<const int, bool> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = bool; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = int]
operator[](const key_type& __k)
^~~~~~~~
/usr/include/c++/6/bits/unordered_map.h:903:7: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const key_type& {aka const int&}'
/usr/include/c++/6/bits/unordered_map.h:907:7: note: candidate: std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type&&) [with _Key = int; _Tp = bool; _Hash = std::hash<int>; _Pred = std::equal_to<int>; _Alloc = std::allocator<std::pair<const int, bool> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = bool; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = int]
operator[](key_type&& __k)
^~~~~~~~
/usr/include/c++/6/bits/unordered_map.h:907:7: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::unordered_map<int, bool>::key_type&& {aka int&&}'
main.cpp:37:38: error: no pre-decrement operator for type
while(f[prev] == true) --prev;
^~~~
main.cpp:39:21: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator-'
if(a[i] - prev <= nxt - a[i]) {
~~~~~^~~~~~
main.cpp:40:36: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator-'
sol += 1LL * (a[i] - prev);
~~~~~^~~~~~
main.cpp:41:18: error: no match for 'operator[]' (operand types are 'std::unordered_map<int, bool>' and '<unresolved overloaded function type>')
f[prev] = true;
^
In file included from /usr/include/c++/6/unordered_map:48:0,
from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:117,
from main.cpp:1:
/usr/include/c++/6/bits/unordered_map.h:903:7: note: candidate: std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type&) [with _Key = int; _Tp = bool; _Hash = std::hash<int>; _Pred = std::equal_to<int>; _Alloc = std::allocator<std::pair<const int, bool> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = bool; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = int]
operator[](const key_type& __k)
^~~~~~~~
/usr/include/c++/6/bits/unordered_map.h:903:7: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const key_type& {aka const int&}'
/usr/include/c++/6/bits/unordered_map.h:907:7: note: candidate: std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type&&) [with _Key = int; _Tp = bool; _Hash = std::hash<int>; _Pred = std::equal_to<int>; _Alloc = std::allocator<std::pair<const int, bool> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = bool; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = int]
operator[](key_type&& __k)
^~~~~~~~
/usr/include/c++/6/bits/unordered_map.h:907:7: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::unordered_map<int, bool>::key_type&& {aka int&&}'
main.cpp:30:9: warning: unused variable 'last' [-Wunused-variable]
int last = -2e9;
^~~~
Non zero exit status: 1
Ceva nu functioneaza?
- Citeste despre borderoul de evaluare.
- Daca tot nu e bine, contacteaza-ne pe forum !