Search found 5 matches

by harrym
Tue Apr 17, 2007 3:51 am
Forum: Volume 2 (200-299)
Topic: 257 - Palinwords
Replies: 16
Views: 7453

complexity?

Whats the complexity of accepted code?
my code is O(n^2) which for the life of me i cant find anything faster and yet i get TLE... any suggestions?

#include<iostream>
#include<string>
using namespace std;
bool pallenword(const string& t) {
if(t.length() <= 4)
return false;
string otherp ...
by harrym
Tue Oct 31, 2006 9:07 pm
Forum: Volume 1 (100-199)
Topic: 109 - SCUD Busters
Replies: 96
Views: 37028

I think it may be the problem after the calling to sites.erase(). After the call, it will invalidate all iterators that refer to the following elements. So, the call should be changed as follows:

iter = sites.erase(iter) - 1;

Shouldnt be a problem since the next statement breaks from that loop ...
by harrym
Sun Sep 17, 2006 6:59 pm
Forum: Volume 1 (100-199)
Topic: 195 - Anagram
Replies: 242
Views: 58767

You should use the <algorithm> library, as in
sort(seq,seq+slen,ch_cmp);
....
while(next_permutation(seq,seq+slen,ch_cmp))

next_permutation will permute all elements between the 2 pointers (arg0,arg1) either by operator< or by arg2 (if provided) and will return 0 when there is no lexicorgraphicly ...
by harrym
Thu Sep 07, 2006 8:57 pm
Forum: Volume 1 (100-199)
Topic: 109 - SCUD Busters
Replies: 96
Views: 37028

[resolved] 109 - WA

Have looked at every post I could find here and tried all of the test cases and for each one someone has claimed that thier ACC code gets the same answer as mine yet, still WA when submitted, anyone have any test cases mine gets wrong that the judge could use? sugestions on how to fix my code ...
by harrym
Thu Sep 07, 2006 8:52 pm
Forum: Volume 1 (100-199)
Topic: 149 - Forests
Replies: 37
Views: 11341

[resolved] 149 not even close

Any ideas why my attempt at 149 is so far off? (returns 88 for given test case)

Everyone loves a good precision error right?

works by breaking all points (-20, .. 21) into 4 quadrents then sorting by distance and checking each point for occlusion by all points in same quadrant with smaller ...

Go to advanced search