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 4174372e4e3db19e744ee01d55542cba7dce5ea1
parent c9a208f6dc8263ff5d0ba267f6ccbb243da5f020
Author: Marc Jeanmougin <mc@localhost.localdomain>
Date:   Fri, 27 Mar 2015 21:38:35 +0100

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

Diffstat:
testing/a3nm/main.cpp | 46+++++-----------------------------------------
1 file changed, 5 insertions(+), 41 deletions(-)

diff --git a/testing/a3nm/main.cpp b/testing/a3nm/main.cpp @@ -18,16 +18,6 @@ vector<int> c1; vector<int> r2; vector<int> c2; -//avant -bool compare_vect(int x, int y){ - if(G[x].size()==G[y].size()){ - return size[x]<size[y]; - } else { - return G[x].size()<G[y].size(); - } -} - - int main(int argc, char **argv) { scanf("%d%d%d%d", &R, &C, &H, &S); @@ -38,7 +28,7 @@ int main(int argc, char **argv) { for (int c = 0; c < C; c++) for (int w = 1; w <= S; w++) for (int h = 1; w * h <= S; h++) { - if (c + w >= C || r + h >= C) + if (c + w >= C || r + h >= R) continue; // out of bounds // count int nham = 0; @@ -71,40 +61,14 @@ int main(int argc, char **argv) { } } - // output + printf("%d\n", (int) G.size()); for (unsigned i = 0; i < G.size(); i++) { - printf("slice %d: %d %d - %d %d: size %d\n", i, r1[i], c1[i], r2[i], c2[i], - size[i]); + printf("%d %d %d %d %d\n", size[i], r1[i], c1[i], r2[i], c2[i]); + printf("%d\n", (int) G[i].size()); for (unsigned j = 0; j < G[i].size(); j++) { - printf("intersects %d: %d %d - %d %d\n", j, r1[j], c1[j], r2[j], c2[j]); - } - } - - //pendant - vector<int> ids(G.size()); - for (unsigned i = 0; i < G.size(); i++) { - ids[i]=i; - } - - sort(ids.begin(),ids.end(),compare_vect); - - vector<bool> taken(G.size(),false); - vector<int> sortie; - - vector<bool> choix; - for(unsigned int i=0;i<G.size();i++){ - if(taken[ids[i]])continue; - sortie.push_back(ids[i]); - for(unsigned int j = 0; j < G[ids[i]].size(); j++){ - taken[j]=true; + printf("%d\n", G[i][j]); } } - - // output - printf("%d\n", (int) sortie.size()); - for (unsigned i = 0; i < sortie.size(); i++) { - printf("%d %d %d %d\n", r1[i], c1[i], r2[i], c2[i]); - } return 0; }