237A - Free Cash - CodeForces Solution


implementation *1000

Please click on ads to support us..

Python Code:

n=int(input())
C=[]
l=[]
for ii in range(n):
    a,b=input().split()
    l.append([a,b])
x,y,c=l[0][0],l[0][1],0
for i in range(0,n):
    if([x,y]!=l[i]):
        C.append(c)
        c=1
        x,y=l[i][0],l[i][1]
    else:
        c+=1
C.append(c)
print(max(C))

C++ Code:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll M=1e9+7;

void solve(){
    map<ll,ll>mp;
    ll n;
    cin>>n;
    ll ans = 0;
    while(n--){
        ll x,y;
        cin>>x>>y;
        ll num = x*60 + y;
        mp[num]++;
        ans = max(ans,mp[num]);
    }
    cout<<ans<<endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll t=1;
    
    // ll t;
    // cin>>t;
    // ll T=t;
    // while(t--){
    //     // cout<<"Case #"<<T-t<<": ";
    //     if(solve()){
    //         cout <<"Yes" <<endl;
    //     }
    //     else{
    //         cout<<"No"<<endl;
    //     }
    // }
    while(t--){
        // cout << fixed << setprecision(9)<<solve()<<endl;
        solve();
        // cout<<solve()<<endl;
    }
	return 0;
}


Comments

Submit
0 Comments
More Questions

189A - Cut Ribbon
1182A - Filling Shapes
82A - Double Cola
45A - Codecraft III
1242A - Tile Painting
1663E - Are You Safe
1663D - Is it rated - 3
1311A - Add Odd or Subtract Even
977F - Consecutive Subsequence
939A - Love Triangle
755A - PolandBall and Hypothesis
760B - Frodo and pillows
1006A - Adjacent Replacements
1195C - Basketball Exercise
1206A - Choose Two Numbers
1438B - Valerii Against Everyone
822A - I'm bored with life
9A - Die Roll
1430B - Barrels
279B - Books
1374B - Multiply by 2 divide by 6
1093B - Letters Rearranging
1213C - Book Reading
1468C - Berpizza
1546B - AquaMoon and Stolen String
1353C - Board Moves
902A - Visiting a Friend
299B - Ksusha the Squirrel
1647D - Madoka and the Best School in Russia
1208A - XORinacci