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 3f7e05952850ef818849e7e5e2b45023ab8767a2
parent c629ac4f9299c166b61ea72ade1fc94f2cdf6037
Author: Marc Jeanmougin <mc@localhost.localdomain>
Date:   Fri, 27 Mar 2015 23:53:47 +0100

meh. too late.

Diffstat:
testing/a3nm/main.cpp | 4+++-
testing/blah.cpp | 16+++++++++-------
2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/testing/a3nm/main.cpp b/testing/a3nm/main.cpp @@ -17,6 +17,7 @@ vector<int> r1; vector<int> c1; vector<int> r2; vector<int> c2; +vector<int> ham; int main(int argc, char **argv) { scanf("%d%d%d%d", &R, &C, &H, &S); @@ -39,6 +40,7 @@ int main(int argc, char **argv) { continue; // not enough ham vector<int> nv; G.push_back(nv); + ham.push_back(nham); r1.push_back(r); r2.push_back(r + h); c1.push_back(c); @@ -68,7 +70,7 @@ int main(int argc, char **argv) { printf("%d\n", (int) G.size()); for (unsigned i = 0; i < G.size(); i++) { - printf("%d %d %d %d %d\n", size[i], r1[i], c1[i], r2[i], c2[i]); + printf("%d %d %d %d %d %d\n", size[i], r1[i], c1[i], r2[i], c2[i], ham[i]); printf("%d\n", (int) G[i].size()); for (unsigned j = 0; j < G[i].size(); j++) { printf("%d\n", G[i][j]); diff --git a/testing/blah.cpp b/testing/blah.cpp @@ -3,8 +3,8 @@ #include <algorithm> using namespace std; -int s,a,b,c,d,e,n; -vector<int> r1,r2,c1,c2,size; +int s,a,b,c,d,e,h,n; +vector<int> r1,r2,c1,c2,size,ham; vector<vector<int> > G; int qual(int x) { @@ -14,11 +14,12 @@ int qual(int x) { //avant bool compare_vect(int x, int y){ - if(size[x] == size[y]){ - return G[x].size()<G[y].size(); - } else { + if(size[x] != size[y]) return size[x]>size[y]; - } + if(ham[x]*size[y] != ham[y]*size[x]) + return ham[x]*size[y] < ham[y]*size[x]; + + return r1[x]<r1[y]; } //bool compare_vect(int x, int y){ @@ -52,11 +53,12 @@ int main(){ scanf("%d",&n); G.resize(n); for(int x=0;x<n;x++){ - scanf("%d%d%d%d%d%d",&s, &a, &b, &c, &d, &e); + scanf("%d%d%d%d%d%d%d",&s, &a, &b, &c, &d, &h, &e); r1.push_back(a); c1.push_back(b); r2.push_back(c); c2.push_back(d); + ham.push_back(h); size.push_back(s); for(int y=0;y<e;y++){ int aa;