ამ გვერდზე თქვენ იხილავთ გაგზავნილი ამოხსნების სტატუსს.
გაგზავნის თარიღი: 20.06.2022 11:04:17
ამოცანა: პასიანსი
მომხმარებელი: deme_bz
ვერდიქტი: ამოუხსნელი
შეფასება: 0 ქულა
#include <bits/stdc++.h> using namespace std; stack < pair<int,int> > s; int main(){ int n; cin >> n; int c,d; cin >> c >> d; s.push({c,d}); for(int i=2;i<=n;i++){ int a,b; cin >>a >> b; if(s.empty==true){ s.push({a,b}); continue; } if(a==s.top().first || b==s.top().second){ s.pop(); } else{ s.push({a,b}); } } if(s.empty()==true){ cout << 0 << endl; return 0; } cout << s.size() << endl; }
main.cpp: In function 'int main()': main.cpp:13:14: error: invalid use of member function 'bool std::stack<_Tp, _Sequence>::empty() const [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >]' (did you forget the '()' ?) if(s.empty==true){ ~~^~~~~