Skip to content
Programming101
Programming101

Learn everything about programming

  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programming101
Programming101

Learn everything about programming

HackerEarth ICPC Team Management problem solution

YASH PAL, 31 July 2024
In this HackerEarth ICPC Team Management problem solution Little Chandan is an exceptional manager – apart from his role in HackerEarth – as the person who has to bug everyone, in general… and if possible, try to get some work done.
He’s also offered a job as the coach of the best Russian teams participating in the ACM-ICPC World Finals. Now, Chandan is an extremely good coach, too. But he’s a weird person who thrives on patterns in life, in general. So, he has decided that if there are n number of students in total, and he is supposed to divide them into camps of k students – he wants them to be arranged in such a way that the length of names of all the students in a camp is equal.
I know, totally weird, right?
HackerEarth ICPC Team Management problem solution

HackerEarth ICPC Team Management problem solution.

tc = int(raw_input())
assert(tc>0 and tc<51)
for i in xrange(tc):
n, k = map(int, raw_input().split())
l = [0]*1000
ok = True
assert(n>0 and n<1001)
assert(k>0 and k<1001)
assert(n>=k)
assert(n%k==0)
for j in xrange(n):
a = raw_input()
l[len(a)] +=1
for z in l:
if z%k!=0:
ok = False
break
if (ok):
print "Possible"
else:
print "Not possible"

Second solution

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define pli pair<ll, int>
#define pb(v, a) v.push_back(a)
#define mp(a, b) make_pair(a, b)
#define MOD 1000000007
#define rep(i, a, b) for(i=a; i<=b; ++i)
#define rrep(i, a, b) for(i=a; i>=b; --i)
#define si(a) scanf("%d", &a)
#define sl(a) scanf("%lld", &a)
#define pi(a) printf("%d", a)
#define pl(a) printf("%lld", a)
#define pn printf("n")
ll pow_mod(ll a, ll b)
{
ll res = 1;
while(b)
{
if(b & 1)
res = (res * a) % MOD;
a = (a * a) % MOD;
b >>= 1;
}
return res;
}
int cnt[105];
int main()
{
int t, i;
si(t);
rep(i, 1, t)
{
memset(cnt, 0, sizeof(cnt));
int n, k, j;
si(n);
si(k);
string str;
rep(j, 1, n)
{
cin>>str;
cnt[str.length()]++;
}
bool flag = true;
rep(j, 1, 100)
{
if(cnt[j] % k)
{
flag = false;
break;
}
}
if(flag)
cout<<"Possiblen";
else
cout<<"Not possiblen";
}
return 0;
}
coding problems solutions

Post navigation

Previous post
Next post
  • HackerRank Separate the Numbers solution
  • How AI Is Revolutionizing Personalized Learning in Schools
  • GTA 5 is the Game of the Year for 2024 and 2025
  • Hackerrank Day 5 loops 30 days of code solution
  • Hackerrank Day 6 Lets Review 30 days of code solution
How to download udemy paid courses for free

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
©2025 Programming101 | WordPress Theme by SuperbThemes