Advertisement
Korotkodul

F

Jan 13th, 2022
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4. #include <queue>
  5. #include <algorithm>
  6. #include <string>
  7. #include <stack>
  8. #include <set>
  9. #include <map>
  10. #define pii pair <int,int>
  11. using namespace std;
  12. using ll = long long;
  13. using ld = long double;
  14. void cv(vector <int> &v){
  15. for (auto x: v) cout<<x<<' ';
  16. cout<<"\n";
  17. }
  18.  
  19. void cvl(vector <ll> &v){
  20. for (auto x: v) cout<<x<<' ';
  21. cout<<"\n";
  22. }
  23.  
  24.  
  25. void cvv(vector <vector <int> > &v){
  26. for (auto x: v) cv(x);
  27. cout<<"\n";
  28. }
  29.  
  30. void cc(vector <char> v){
  31. for (char x: v) cout<<x;
  32. cout<<"\n\n";
  33. }
  34.  
  35. void cb(vector <bool> v){
  36. for (bool x: v) cout<<x;
  37. cout<<"\n\n";
  38. }
  39.  
  40. int main()
  41. {
  42. ios::sync_with_stdio(0);
  43. cin.tie(0);
  44. cout.tie(0);
  45. int n,m; cin>>n>>m;
  46. vector <bool> chk(m, 0), gn(m, 0);
  47. int couch=0, bad=0;
  48. for (int i = 0; i < n;++i){
  49. char act; cin>>act;
  50. vector <bool> now(n);
  51. for (int j =0;j<m;++j){
  52. char x; cin>>x;
  53. if (x == '0') now[j] = 0;
  54. else now[j] = 1;
  55. //cin>>now[j];
  56. }
  57.  
  58.  
  59.  
  60. if (act == '+'){
  61. //continue;
  62. for (int j = 0;j<m;++j){
  63. if (now[j]){
  64. //if (chk[j])
  65. gn[j] = 1;
  66. }
  67. }
  68. }
  69. else{
  70. bool ok = 1;
  71. //couch++;
  72. //continue;
  73. for (int j = 0 ; j < m;++j){
  74. if (now[j]){
  75. if (!gn[j]){
  76. ok = 0;
  77. }
  78. gn[j] = 0;
  79. }
  80. }
  81. if (!ok){
  82. bad++;
  83. }
  84. }
  85. //cout<<"now\n";
  86. //cc(now);
  87. //cout<<"chk\n";
  88. //cb(chk);
  89.  
  90.  
  91. }
  92. cout<<bad<<"\n";
  93. }
  94. /*
  95. 4 3
  96. + 111
  97. - 101
  98. + 001
  99. - 111
  100. */
  101.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement