commit 89fdc96e4331e0dbe8f0b8997552390a50df4b01
parent 1f08c46930643ff4b80001e75206c18ad169f5f2
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Thu, 12 Mar 2015 19:47:09 +0100
final
Diffstat:
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/a3nm/server.cpp b/a3nm/server.cpp
@@ -47,6 +47,8 @@ int main() {
sort(serv.begin(), serv.end());
reverse(serv.begin(), serv.end());
+ // now keep only the servers we will use
+
for (int i = 0; i < M; i++) {
fposr[i] = fposc[i] = fgroup[i] = -1;
}
@@ -106,6 +108,21 @@ int main() {
fgroup[serv[i].id] = idx;
}
}
+
+
+ int fguar[MAXN];
+ for (int j = 0; j < P; j++)
+ fguar[j] = capa[j];
+ for (int j = 0; j < R; j++)
+ for (int k = 0; k < P; k++)
+ fguar[k] = min(fguar[k], capa[k] - gcapa[j][k]);
+ int mfguar = fguar[0], idx = 0;
+ for (int j = 0; j < P; j++)
+ if (fguar[j] < mfguar) {
+ mfguar = fguar[j];
+ }
+
+ printf("FINAL: %d\n", mfguar);
for (int i = 0; i < R; i++) {
for (int j = 0; j < S; j++)
@@ -113,7 +130,6 @@ int main() {
putchar('\n');
}
-
// display sol
for (int i= 0 ; i < M; i++) {
if (fposr[i] >= 0)