ამოხსნების სტატუსი

ამ გვერდზე თქვენ იხილავთ გაგზავნილი ამოხსნების სტატუსს.


გაგზავნის თარიღი: 05.12.2019 23:54:08

ამოცანა: პასიანსი

მომხმარებელი: demetrebiwi

ვერდიქტი: ამოუხსნელი

შეფასება: 0 ქულა







#include <bits/stdc++.h>

using namespace std;

int main()
{   int i,n,a,b;
    stack <pair<int,int> >gg;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a>>b;
        if((!gg.empty()) && (gg.top() first==a||gg.top() second==b))
           {
               gg.pop();
                continue;
           }
    gg.push({a,b})
    }
    cout<<gg.size()<<endl;
    return 0;
}
PROB_cpp_UID238PID171_155701/main.cpp: In function 'int main()':
PROB_cpp_UID238PID171_155701/main.cpp:12:39: error: expected ')' before 'first'
         if((!gg.empty()) && (gg.top() first==a||gg.top() second==b))
                                       ^~~~~
PROB_cpp_UID238PID171_155701/main.cpp:12:26: error: no match for 'operator&&' (operand types are 'bool' and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka std::pair<int, int>}')
         if((!gg.empty()) && (gg.top() first==a||gg.top() second==b))
            ~~~~~~~~~~~~~~^~~~~~~~~~~~~~
PROB_cpp_UID238PID171_155701/main.cpp:12:26: note: candidate: operator&&(bool, bool) <built-in>
PROB_cpp_UID238PID171_155701/main.cpp:12:26: note:   no known conversion for argument 2 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka std::pair<int, int>}' to 'bool'
In file included from /usr/include/c++/6/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:95,
                 from PROB_cpp_UID238PID171_155701/main.cpp:1:
/usr/include/c++/6/bits/valarray_after.h:412:5: note: candidate: template<class _Dom1, class _Dom2> std::_Expr<std::_BinClos<std::__logical_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&)
     _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and)
     ^
/usr/include/c++/6/bits/valarray_after.h:412:5: note:   template argument deduction/substitution failed:
PROB_cpp_UID238PID171_155701/main.cpp:16:12: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool'
            }
            ^
In file included from /usr/include/c++/6/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:95,
                 from PROB_cpp_UID238PID171_155701/main.cpp:1:
/usr/include/c++/6/bits/valarray_after.h:412:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__logical_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)
     _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and)
     ^
/usr/include/c++/6/bits/valarray_after.h:412:5: note:   template argument deduction/substitution failed:
PROB_cpp_UID238PID171_155701/main.cpp:16:12: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool'
            }
            ^
In file included from /usr/include/c++/6/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:95,
                 from PROB_cpp_UID238PID171_155701/main.cpp:1:
/usr/include/c++/6/bits/valarray_after.h:412:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__logical_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)
     _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and)
     ^
/usr/include/c++/6/bits/valarray_after.h:412:5: note:   template argument deduction/substitution failed:
PROB_cpp_UID238PID171_155701/main.cpp:16:12: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka std::pair<int, int>}' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
            }
            ^
In file included from /usr/include/c++/6/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:95,
                 from PROB_cpp_UID238PID171_155701/main.cpp:1:
/usr/include/c++/6/bits/valarray_after.h:412:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__logical_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&)
     _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and)
     ^
/usr/include/c++/6/bits/valarray_after.h:412:5: note:   template argument deduction/substitution failed:
PROB_cpp_UID238PID171_155701/main.cpp:16:12: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool'
            }
            ^
In file included from /usr/include/c++/6/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:95,
                 from PROB_cpp_UID238PID171_155701/main.cpp:1:
/usr/include/c++/6/bits/valarray_after.h:412:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__logical_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&)
     _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and)
     ^
/usr/include/c++/6/bits/valarray_after.h:412:5: note:   template argument deduction/substitution failed:
PROB_cpp_UID238PID171_155701/main.cpp:16:12: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka std::pair<int, int>}' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
            }
            ^
In file included from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:95:0,
                 from PROB_cpp_UID238PID171_155701/main.cpp:1:
/usr/include/c++/6/valarray:1177:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__logical_and, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const std::valarray<_Tp>&, const std::valarray<_Tp>&)
 _DEFINE_BINARY_OPERATOR(&&, __logical_and)
 ^
/usr/include/c++/6/valarray:1177:1: note:   template argument deduction/substitution failed:
PROB_cpp_UID238PID171_155701/main.cpp:16:12: note:   mismatched types 'const std::valarray<_Tp>' and 'bool'
            }
            ^
In file included from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:95:0,
                 from PROB_cpp_UID238PID171_155701/main.cpp:1:
/usr/include/c++/6/valarray:1177:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__logical_and, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const std::valarray<_Tp>&, const _Tp&)
 _DEFINE_BINARY_OPERATOR(&&, __logical_and)
 ^
/usr/include/c++/6/valarray:1177:1: note:   template argument deduction/substitution failed:
PROB_cpp_UID238PID171_155701/main.cpp:16:12: note:   mismatched types 'const std::valarray<_Tp>' and 'bool'
            }
            ^
In file included from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:95:0,
                 from PROB_cpp_UID238PID171_155701/main.cpp:1:
/usr/include/c++/6/valarray:1177:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__logical_and, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const _Tp&, const std::valarray<_Tp>&)
 _DEFINE_BINARY_OPERATOR(&&, __logical_and)
 ^
/usr/include/c++/6/valarray:1177:1: note:   template argument deduction/substitution failed:
PROB_cpp_UID238PID171_155701/main.cpp:16:12: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> > >::value_type {aka std::pair<int, int>}' is not derived from 'const std::valarray<_Tp>'
            }
            ^
PROB_cpp_UID238PID171_155701/main.cpp:17:5: error: expected ')' before 'gg'
     gg.push({a,b})
     ^~
PROB_cpp_UID238PID171_155701/main.cpp:18:5: error: expected primary-expression before '}' token
     }
     ^