commit b68d84528d850ae5c042410ad4e72ea67ee3aed6
parent 0a32284cab5bee33c70f567b65ad47f16b3db751
Author: Marc Jeanmougin <marc@jeanmougin.fr>
Date: Sat, 5 Apr 2014 11:49:58 +0200
fix
Diffstat:
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/contest/mc/mc.cpp b/contest/mc/mc.cpp
@@ -4,6 +4,9 @@
#include <algorithm>
#include <cstdio>
+#define N_SOMMETS_MAJ 12000
+#define N_ARETES_MAJ 18000
+
using namespace std;
int n_sommets;
@@ -12,18 +15,18 @@ using namespace std;
int n_vehicules;
int depart;
-double longitudes[12000];
-double latitudes[12000];
-
-int departs[18000];//depart
-int arrivees[18000];//arrivee
-bool dbsens[18000];//rue a double sens
-int couts[18000];//cout(temps)
-int longueurs[18000];//longueur
+double longitudes[N_SOMMETS_MAJ];
+double latitudes[N_SOMMETS_MAJ];
+int departs[N_ARETES_MAJ];//depart
+int arrivees[N_ARETES_MAJ];//arrivee
+bool dbsens[N_ARETES_MAJ];//rue a double sens
+int couts[N_ARETES_MAJ];//cout(temps)
+int longueurs[N_ARETES_MAJ];//longueur
+vector<vector<int> > adj(N_ARETES_MAJ); // matrice d'adjacence
-int main(){
+void lecture_entree(){
scanf("%d",&n_sommets);
scanf("%d",&n_aretes);
scanf("%d",&t_autorise);
@@ -31,17 +34,24 @@ int main(){
scanf("%d",&depart);
for(int i=0;i<n_sommets;i++)scanf("%lf %lf",&longitudes[i],&latitudes[i]);
-vector<vector<int> > adj(12000);
for(int i=0;i<n_aretes;i++){
int x;
scanf("%d %d %d %d %d",&departs[i],&arrivees[i],&x,&couts[i],&longueurs[i]);
dbsens[i]=(x==2);
- adj[departs[i]].push_back(arrivees[i]);
+ adj[departs[i]].push_back(arrivees[i]);
if(dbsens[i]) adj[arrivees[i]].push_back(departs[i]);
}
+
+}
+
+
+int main(){
+lecture_entree();
for(int i=0;i<n_sommets;i++)printf("%d %d\n",i,adj[i].size());
+
+
}