commit 084ee2c5e93a194b6f8e139eb4b8f03589ccdd25
parent 053aafb22056b62bfe69d15f5e752d1366d972cb
Author: Jachiet Louis <louis@jachiet.com>
Date: Sat, 5 Apr 2014 13:55:05 +0200
Merge branch 'master' of gitorious.org:ens-ulm-1/ens-ulm-1
Diffstat:
1 file changed, 28 insertions(+), 0 deletions(-)
diff --git a/contest/mc/lecture.cpp b/contest/mc/lecture.cpp
@@ -70,6 +70,34 @@ vector<int> evalue_solution(vector<int> trajectoires[]) {
return resultat;
}
+int score_solution(vector<int> trajectoires[]) {
+ vector<int> v = evalue_solution(trajectoires);
+ return v[0];
+}
+
+// in-place truncation to a maximum
+// return 0 unless invalid edge
+int tronque_solution(vector<int> trajectoires[], int max_limit) {
+ for (int i=0; i< n_vehicules; i++) {
+ int temps = 0;
+ for (int j=0; j< trajectoires[i].size() - 1; j++) {
+ pair<int, int> p = make_pair(trajectoires[i][j], trajectoires[i][j+1]);
+ int a = id_arete[p];
+ if (!a) {
+ return -1;
+ }
+ temps += cout[a];
+ if (temps > max_limit) {
+ // j'ai deborde, je cesse la
+ trajectoires[i].resize(j);
+ break;
+ }
+ }
+ }
+ return 0;
+}
+
+
void lecture_entree(){
scanf("%d",&n_sommets);
scanf("%d",&n_aretes);