commit 6400b6238855797b418512f1b0ad767a440ede41
parent ffdf146d7d50484c1889e850f7ba744b23a13a18
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Fri, 13 Mar 2015 13:41:05 +0100
fix indent, comment
Diffstat:
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/selection/a3nm/388.cpp b/selection/a3nm/388.cpp
@@ -6,12 +6,13 @@ using namespace std;
#define MAXN 1002
-struct Server{
- int id, z, c;
- Server(int id=0, int z=0, int c=0) : id(id), z(z), c(c) {}
- bool operator< (const Server &s) const{
- return z*s.c*MAXN + s.z < s.z*c*MAXN + z;
- }
+struct Server {
+ int id, z, c;
+ Server(int id = 0, int z = 0, int c = 0) : id(id), z(z), c(c) {}
+ bool operator< (const Server &s) const {
+ // a/b < c/d iff da < bc and (e, f) < (g, h) with f,h < N iff eN+f < gN+h
+ return z*s.c*MAXN + s.z < s.z*c*MAXN + z;
+ }
};
int R, S, U, P, M;