ens-ulm-1-2015

google hashcode 2015 source for team ens-ulm-1
git clone https://a3nm.net/git/ens-ulm-1-2015/
Log | Files | Refs

commit 6683314e55434d92fcfef21e5966b2c440429503
parent c9ac886c5801819523ebf5bf4bd38e1ac379dcda
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Thu, 12 Mar 2015 19:30:41 +0100

Merge branch 'master' of github.com:a3nm/ens-ulm-1

Diffstat:
a3nm/server.cpp | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/a3nm/server.cpp b/a3nm/server.cpp @@ -10,6 +10,14 @@ using namespace std; typedef pair<int,int> pii; typedef pair<int,pii> piii; +struct Server{ + int id, z, c; + Server(int id=0, z=0, c=0) : id(id), z(z), c(c) {} + bool operator< (const Server &s) const{ + return z/c < s.z/s.c; + } +}; + int main() { int R, S, U, P, M; vector<pii> serv; @@ -33,7 +41,7 @@ int main() { int z, c; scanf("%d", &z); scanf("%d", &c); - serv.push_back(make_pair<int, int>(c/z, z)); + serv.push_back(Server(i, z, c)); } sort(serv.begin(), serv.end());