Skip to content

Instantly share code, notes, and snippets.

@popey456963
Created October 25, 2015 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save popey456963/00401723ae737b86f7a9 to your computer and use it in GitHub Desktop.
Save popey456963/00401723ae737b86f7a9 to your computer and use it in GitHub Desktop.
Skillful Thinking
import random
project_skills = input().split(" ")
worker_skills = []
n = int(input())
for i in range(n):
worker_skills.append(input().split(" "))
top = 99999
for i in range(100):
worker_skills = random.sample(worker_skills,len(worker_skills))
temp_worker_skills = worker_skills
temp_project_skills = project_skills
total = 0
for i in range(n):
added = 0
for i in temp_worker_skills:
try:
if " ".join(i) in " ".join(temp_project_skills):
found = temp_project_skills.index(i)
temp_project_skills.pop(found)
added = 1
except:
pass
if added == 1:
total += 1
if total < top:
top = total
print(top)
@developius
Copy link

skills = {}
project_skills = input().split(" ")
workers = int(input())
workers_end = 0
for i in range(workers):
    worker_skills = input().split(" ")
    counted = False
    for skill in project_skills:
        if skill in worker_skills:
            if not counted:
                workers_end+=1
            counted=True
print(workers_end)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment