Skip to content
Programmingoneonone - Logo
Programmingoneonone
  • Engineering Subjects
    • Internet of Things (IoT)
    • Computer System Architecture
    • Microprocessor
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
    • 100+ C++ Programs
  • Solutions
    • HackerRank
      • Algorithms Solutions
      • C solutions
      • C++ solutions
      • Java solutions
      • Python solutions
      • Data Structures Solutions
    • Leetcode Solutions
    • HackerEarth Solutions
  • Work with US
Programmingoneonone - Logo
Programmingoneonone

HackerEarth ICPC Team Management problem solution

YASH PAL, 31 July 202414 February 2026
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 HackerEarth HackerEarth

Post navigation

Previous post
Next post

Leave a Reply

Your email address will not be published. Required fields are marked *

Programmingoneonone

We at Programmingoneonone, also known as Programming101 is a learning hub of programming and other related stuff. We provide free learning tutorials/articles related to programming and other technical stuff to people who are eager to learn about it.

Pages

  • About US
  • Contact US
  • Privacy Policy
  • DMCA

Practice

  • Java
  • C++
  • C

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes