Regolamento ammissione alle Territoriali OII 2025/26

In questa pagina trovate le regole di ammissione alle Territoriali OII 2025/26, descritte algoritmicamente come codice in diversi linguaggi, in caso la formulazione in linguaggio naturale vi risulti ambigua.

Python:

def classifica_tutti(scuola: scuola) -> list[studente]:
    "tutti i partecipanti della scuola alle scolastiche"
    "anche se non eleggibili, listati in ordine di:"
    "- punteggio decrescente;"
    "- classe crescente;"
    "- data di nascita decrescente."

def quota(scuola: scuola) -> int:
    num = len(classifica_tutti(scuola))
    return round(num / 20)

def eleggibile(studente: studente) -> bool:
    if studente.classe == 5:
        return False
    if studente.data_di_nascita < "01-07-2007":
        return False
    return studente.iscritto

def classifica_eleggibili(scuola: scuola) -> list[studente]:
    return [s for s in classifica_tutti(scuola) if eleggibile(s) and not s.medaglia_oii2425 >= "menzione"]

def sopra_soglia(studente: studente, pos: int, quota: int) -> bool:
    if pos < quota and studente.punteggio > 20:
        return True
    if studente.classe <= 2 and studente.punteggio >= 55:
        return True
    if studente.punteggio >= 65:
        return True

def ammissibili(scuola: scuola) -> list[studente]:
    ammessi = [s for pos, s in enumerate(classifica_eleggibili(scuola)) if sopra_soglia(studente, pos, quota(scuola))]
    return ammessi[:25]

def ammesso_preterry(studente: studente) -> bool:
    if studente.finali_ois2526:
        return True
    if studente.medaglia_oii2425 >= "menzione":
        return True
    if studente in ammissibili(studente.scuola):
        return True
    return False

def ammesso_terry(studente: studente) -> bool:
    return ammesso_preterry(studente) and studente.punteggio_preterry >= 50

Pseudocodice:

function classifica_tutti(scuola: scuola)  studente[]
    tutti i partecipanti della scuola alle scolastiche
    anche se non eleggibili, listati in ordine di:
    - punteggio decrescente;
    - classe crescente;
    - data di nascita decrescente.
end function

function quota(scuola: scuola)  integer
    variable num: integer
    num  lunghezza(classifica_tutti(scuola))
    return arrotonda(num / 20)
end function

function eleggibile(studente: studente)  boolean
    if classe(studente) == 5 then
        return false
    end if
    if data_di_nascita(studente) < 01-07-2007 then
        return false
    end if
    return iscritto(studente)
end function

function classifica_eleggibili(scuola: scuola)  studente[]
    variable tutti: studente[]
    tutti  classifica_tutti(scuola)
    variable eleggibili: studente[]
    eleggibili  lista_vuota()
    for i in [0 lunghezza(tutti)) do
        variable già_ammesso: boolean
        già_ammesso  medaglia_oii2425(studente)  menzione
        if (eleggibile(tutti[i])) and (not (già_ammesso)) then
            aggiungi(eleggibili, tutti[i])
        end if
    end for
    return eleggibili
end function

function sopra_soglia(studente: studente, pos: integer, quota: integer)  boolean
    if (pos < quota) and (punteggio(studente) > 20) then
        return true
    end if
    if (classe(studente)  2) and (punteggio(studente)  55) then
        return true
    end if
    if punteggio(studente)  65 then
        return true
    end if
    return false
end function

function ammissibili(scuola: scuola)  studente[]
    variable eleggibili: studente[]
    eleggibili  classifica_eleggibili(scuola)
    variable ammessi: studente[]
    ammessi  lista_vuota()
    for pos in [0 lunghezza(eleggibili)) do
        if (sopra_soglia(eleggibili[pos], pos, quota(scuola))) and (lunghezza(ammessi) < 25) then
            aggiungi(ammessi, eleggibili[pos])
        end if
    end for
    return ammessi
end function

function ammesso_preterry(studente: studente)  boolean
    if finali_ois2526(studente) then
        return true
    end if
    if medaglia_oii2425(studente)  menzione then
        return true
    end if
    if in_lista(studente, ammissibili(scuola_di(studente))) then
        return true
    end if
    return false
end function

function ammesso_terry(studente: studente)  boolean
    if (ammesso_preterry(studente)) and (punteggio_preterry(studente)  50) then
        return true
    end if
    return false
end function

Blocchi:

immagine