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 df6466c226541954a968ce6884a2eae200800503
parent 4174372e4e3db19e744ee01d55542cba7dce5ea1
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Fri, 27 Mar 2015 22:02:21 +0100

fix

Diffstat:
testing/a3nm/main.cpp | 7++++++-
testing/blah.cpp | 36++++++++++++++++++++++++++----------
2 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/testing/a3nm/main.cpp b/testing/a3nm/main.cpp @@ -28,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 >= R) + if (c + w > C || r + h > R) continue; // out of bounds // count int nham = 0; @@ -56,6 +56,11 @@ int main(int argc, char **argv) { if (r2[j] <= r1[i] || r1[j] >= r2[i] || c2[j] <= c1[i] || c1[j] >= c2[i]) continue; // not overlap +// if (r1[i] == 0 && c1[i] == 0 && r2[i] == 1 && c2[i] == 8) { +// if (r1[j] == 0 && c1[j] == 0 && r2[j] == 1 && c2[j] == 9) { +// printf("YESSS %d %d\n", i, j); +// } +// } G[i].push_back(j); G[j].push_back(i); } diff --git a/testing/blah.cpp b/testing/blah.cpp @@ -9,27 +9,42 @@ vector<vector<int> > G; //avant bool compare_vect(int x, int y){ - if(G[x].size()==G[y].size()){ - return size[x]<size[y]; - } else { + if(size[x] == size[y]){ return G[x].size()<G[y].size(); + } else { + return size[x]>size[y]; } } +//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(){ scanf("%d",&n); G.resize(n); for(int x=0;x<n;x++){ - scanf("%d%d%d%d%d",&s, &a, &b, &c, &d, &e); + scanf("%d%d%d%d%d%d",&s, &a, &b, &c, &d, &e); r1.push_back(a); - r2.push_back(b); - c1.push_back(c); + c1.push_back(b); + r2.push_back(c); c2.push_back(d); size.push_back(s); for(int y=0;y<e;y++){ - scanf("%d", &a); - G[x].push_back(y); + int aa; + scanf("%d", &aa); + G[x].push_back(aa); +// if (r1[x] == 0 && c1[x] == 0 && r2[x] == 1 && c2[x] == 8) { +// printf("COUCOU %d\n", aa); +// if (r1[aa] == 0 && c1[aa] == 0 && r2[aa] == 1 && c2[aa] == 9) { +// printf("YESSS\n"); +// } +// } } } @@ -43,11 +58,12 @@ int main(){ 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; + printf("je prends %d\n", ids[i]); sortie.push_back(ids[i]); for(unsigned int j = 0; j < G[ids[i]].size(); j++){ + printf("j'exclus %d\n", G[ids[i]][j]); taken[G[ids[i]][j]]=true; } } @@ -55,7 +71,7 @@ int main(){ // 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]); + printf("%d %d %d %d\n", r1[sortie[i]], c1[sortie[i]], r2[sortie[i]]-1, c2[sortie[i]]-1); } return 0;