|
@@ -163,13 +163,13 @@
|
|
|
\end{problema}
|
|
\end{problema}
|
|
|
|
|
|
|
|
\begin{problema}{stevenBradbury}{j: JJOO}{Atleta}
|
|
\begin{problema}{stevenBradbury}{j: JJOO}{Atleta}
|
|
|
- //Requiere que al menos una competencia ya haya finalizado (y, por lo tanto, se haya entregado un oro)
|
|
|
|
|
|
|
+ //Requiere que al menos una competencia ya haya finalizado (y, por lo tanto, se haya entregado un oro)\newline
|
|
|
\requiere{algunOro: long([comp | comp \leftarrow todasLasCompetencias(j), finalizada(comp)\wedge|ranking(comp)|>0])>0}
|
|
\requiere{algunOro: long([comp | comp \leftarrow todasLasCompetencias(j), finalizada(comp)\wedge|ranking(comp)|>0])>0}
|
|
|
|
|
|
|
|
- //Asegura que result haya ganado un oro
|
|
|
|
|
|
|
+ //Asegura que result haya ganado un oro\newline
|
|
|
\asegura{ganoOro: existe(f \leftarrow [ranking(comp)[0] | comp \leftarrow todasLasCompetencias(j), finalizada(comp)\wedge|ranking(comp)|>0]) ciaNumber(result)==ciaNumber(f)}
|
|
\asegura{ganoOro: existe(f \leftarrow [ranking(comp)[0] | comp \leftarrow todasLasCompetencias(j), finalizada(comp)\wedge|ranking(comp)|>0]) ciaNumber(result)==ciaNumber(f)}
|
|
|
|
|
|
|
|
- //Asegura que entre todos los ganadores de oro, el result es el que tiene la menor habilidad en alguna de las medallas que gano.
|
|
|
|
|
|
|
+ //Asegura que entre todos los ganadores de oro, el result es el que tiene la menor habilidad en alguna de las medallas que gano.\newline
|
|
|
\asegura{esElPeor: existe(dep \leftarrow deportesEnLosQueGano(j, result)) paraTodo(f \leftarrow [ranking(comp)[0] | comp \leftarrow todasLasCompetencias(j), finalizada(comp)\wedge|ranking(comp)|>0]) capacidad(result, dep) <= capacidad(f, prm(categoria(comp))}
|
|
\asegura{esElPeor: existe(dep \leftarrow deportesEnLosQueGano(j, result)) paraTodo(f \leftarrow [ranking(comp)[0] | comp \leftarrow todasLasCompetencias(j), finalizada(comp)\wedge|ranking(comp)|>0]) capacidad(result, dep) <= capacidad(f, prm(categoria(comp))}
|
|
|
|
|
|
|
|
\aux{deportesEnLosQueGanoOro}{j: JJOO, a: Atleta}{[Deportes]}
|
|
\aux{deportesEnLosQueGanoOro}{j: JJOO, a: Atleta}{[Deportes]}
|
|
@@ -182,26 +182,41 @@
|
|
|
|
|
|
|
|
\begin{problema}{sequ\'iaOl\'impica}{j: JJOO}{[Pa\'is]}
|
|
\begin{problema}{sequ\'iaOl\'impica}{j: JJOO}{[Pa\'is]}
|
|
|
|
|
|
|
|
- \asegura{ (\forall p \leftarrow result) sequiaPais(p) == maximaSequia(j)}
|
|
|
|
|
- \asegura{ (\forall p \leftarrow listaPaisesConSequia(j), sequiaPais(p)==maximaSequia(j)) p \in result }
|
|
|
|
|
|
|
+ \asegura{ (\forall p \leftarrow result) sequiaPais(p) == maximaSequia(j)}
|
|
|
|
|
+ \asegura{ (\forall p \leftarrow listaPaisesConSequia(j), sequiaPais(p)==maximaSequia(j)) p \in result }
|
|
|
|
|
|
|
|
- \aux{sequiaPais}{p:pais}{\ent}{jornadaActual(j)-cuantosDiasGano(p)}
|
|
|
|
|
|
|
+ \aux{sequiaPais}{p:pais}{\ent}{cerosSeguidos([ ganoEnElDia(dia,p) | dia \leftarrow [1..cantDias(j)] ])}
|
|
|
|
|
|
|
|
- \aux{cuantosDiasGano}{p:pais}{\ent}
|
|
|
|
|
- {|[ 1 | x \leftarrow [0..jornadaActual(j)-1], ganoEnElDia(x,p) ]|}
|
|
|
|
|
|
|
+ \aux{ganoEnElDia}{dia,pais}{Bool}
|
|
|
|
|
+ {\newline|[ 1 | c \leftarrow cronograma(j, dia), en(pais, paisesQueGanaronCompetencia(c)) ]|>0}
|
|
|
|
|
|
|
|
- \aux{ganoEnElDia}{dia,pais}{Bool}
|
|
|
|
|
- {|[ 1 | c \leftarrow cronograma(j, dia), en(pais, paisesQueGanaronCompetencia(c)) ]|>0}
|
|
|
|
|
|
|
+ \aux{listaPaisesConSequia}{j: JJOO}{[(Pais, Int)]}
|
|
|
|
|
+ {[(p, sequiaPais(p)) | p \leftarrow listaPaises(j)]}
|
|
|
|
|
|
|
|
- \aux{listaPaisesConSequia}{j: JJOO}{[(Pais, Int)]}
|
|
|
|
|
- {[(p, sequiaPais(p)) | p \leftarrow listaPaises(j)]}
|
|
|
|
|
|
|
+ \aux{maximaSequia}{j: JJOO}{\ent}
|
|
|
|
|
+ {maximoLista([ sequiaPais(p) | p \leftarrow listaPaises(j)])}
|
|
|
|
|
|
|
|
- \aux{maximaSequia}{j: JJOO}{\ent}
|
|
|
|
|
- {maximoLista([ sequiaPais(p) | p \leftarrow listaPaises(j)])}
|
|
|
|
|
|
|
+ \aux{paisesQueGanaronCompetencia}{c:Competencia}{[paises]}
|
|
|
|
|
+ {\newline [ pais(ranking(c)[a]) | a \leftarrow [0.. |ranking(c) |-1 ], a <= 2 ]}
|
|
|
|
|
|
|
|
- \aux{paisesQueGanaronCompetencia}{c:Competencia}{[paises]}
|
|
|
|
|
- {\newline [ pais(ranking(c)[a]) | a \leftarrow [0.. |ranking(c) |-1 ], a <= 2 ]}
|
|
|
|
|
|
|
+ // genera lista de pares con la coordenada de cada (0, 1) \newline
|
|
|
|
|
+ \aux{f1}{ls:[\ent]}{[(\ent,\ent)]}
|
|
|
|
|
+ {[ (c,c1) | c \leftarrow [0..|ls|-1], c1 \leftarrow [c.. |ls|-1], ls[c]==0 \wedge ls[c1]==1 ]}
|
|
|
|
|
|
|
|
|
|
+ //Filtra para que no repita prim() en la lista \newline
|
|
|
|
|
+ \aux{f2}{ls:[(\ent,\ent)]}{[(\ent,\ent)]}
|
|
|
|
|
+ {[ ls(i) | i \leftarrow [0..|ls|-1], j\leftarrow [i..|ls|-1], prm(ls[i]) != prm(ls[j]) ]}
|
|
|
|
|
+
|
|
|
|
|
+ //Filtra para que no repita sgd() en la lista \newline
|
|
|
|
|
+ \aux{f3}{ls:[(\ent,\ent)]}{[(\ent,\ent)]}
|
|
|
|
|
+ {[ ls(i) | i \leftarrow [0..|ls|-1], j\leftarrow [i..|ls|-1], sgd(ls[i]) != sgd(ls[j]) ]}
|
|
|
|
|
+
|
|
|
|
|
+ //me da la diferencia de (a,b) como b-a \newline
|
|
|
|
|
+ \aux{f4}{ls:[(\ent,\ent)]}{[\ent]}
|
|
|
|
|
+ {[ sgd(el) - prm(el) | el \leftarrow ls]}
|
|
|
|
|
+
|
|
|
|
|
+ \aux{cerosSeguidos}{ls:[Bool]}{\ent}
|
|
|
|
|
+ {max(f4(f3(f2(f1(ls)))))}
|
|
|
\end{problema}
|
|
\end{problema}
|
|
|
|
|
|
|
|
\begin{problema}{transcurrirDia}{j: JJOO}{}
|
|
\begin{problema}{transcurrirDia}{j: JJOO}{}
|