1818A - Politics - CodeForces Solution


greedy implementation *800

Please click on ads to support us..

C++ Code:

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define maxheap(type) priority_queue<type>;
#define minheap(type) priority_queue<type,vector<type>,greater<type>>


void solve();

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;
    cin>>t; // test case hain kya? 
    while(t--){
        solve();
        cout<<"\n";
    };
    return 0;
}

void solve() {
    int n,k;
    cin>>n>>k;
    vector<string> v(n);
    int ans = 1;
    for(int i=0; i<n; i++){
        cin>>v[i];
        if(i > 0){
            if(v[i] == v[0]){
                ans++;
            }
        }
    }
    cout<<ans;
}


Comments

Submit
0 Comments
More Questions

1110A - Parity
1215B - The Number of Products
604C - Alternative Thinking
1204C - Anna Svyatoslav and Maps
322A - Ciel and Dancing
1689B - Mystic Permutation
1711B - Party
1702D - Not a Cheap String
1714F - Build a Tree and That Is It
1703F - Yet Another Problem About Pairs Satisfying an Inequality
610A - Pasha and Stick
1200A - Hotelier
1091A - New Year and the Christmas Ornament
1352B - Same Parity Summands
1102A - Integer Sequence Dividing
630B - Moore's Law
1004A - Sonya and Hotels
1680B - Robots
1690A - Print a Pedestal (Codeforces logo)
1295A - Display The Number
1077A - Frog Jumping
1714G - Path Prefixes
1369C - RationalLee
289B - Polo the Penguin and Matrix
1716A - 2-3 Moves
1670B - Dorms War
1716B - Permutation Chain
987A - Infinity Gauntlet
1676G - White-Black Balanced Subtrees
1716D - Chip Move