Search found 31 matches

Thu Nov 15, 2007 5:34 pm
Forum: Volume 113 (11300-11399)
Topic: 11345 - Rectangles
Replies: 27
Views: 8844
what happens when r.x1>r.x2 or r.y1>r.y2 in your algorithm? I think I handle all of these: 1) r.x1 > r.x2 => r2.x1 > min(r1.x2, r2.x2) we know r2.x1 < r2.x2 so we must have r1.x2 < r2.x1 that I handle this. 2) r.y1 > r.y2 => max(r1.y1, r2.y1) > min(r1.y2, r2.y2) suppose that min(r1.y2, r2.y2) = r1....
Wed Nov 14, 2007 8:28 pm
Forum: Volume 113 (11300-11399)
Topic: 11345 - Rectangles
Replies: 27
Views: 8844
Is there any tricky IO? All I did was to find the maximum x1, minimum x2, maximum y1 and minimum y2 over all input. As a side effect, if x2<=x1 or y2<=y1 in any rectangle, the answer is 0 Thanks sclo for your quick reply. Your method is much better than mine and it works correctly but I don't know ...
Tue Nov 13, 2007 10:41 pm
Forum: Volume 113 (11300-11399)
Topic: 11352 - Crazy King
Replies: 32
Views: 11878
The problem statement said that a horse can move atmost 1 movement so you shouldn't mark the squares that horse can reach with 'Z' if you do it then horse can move more than 1 movement so you must mark reachable squares by horse with another character and be careful about squares that there exist a ...
Tue Nov 13, 2007 8:23 pm
Forum: Volume 113 (11300-11399)
Topic: 11345 - Rectangles
Replies: 27
Views: 8844
Is there any tricky IO?
Tue Nov 13, 2007 7:32 pm
Forum: Volume 113 (11300-11399)
Topic: 11345 - Rectangles
Replies: 27
Views: 8844
rio wrote:Try this.
INPUT:

Code: Select all

``````1
2
0 0 1 1
1 1 0 0
``````
OUTPUT:

Code: Select all

``````Case 1: 0
``````
ADD : If you meet these kind of problems, try everything. Finding the trick is also the part of the problem.
----
Rio
Are you sure? I think the answer is 1 not 0. because two rectangles are the same.
Tue Nov 13, 2007 2:50 pm
Forum: Volume 113 (11300-11399)
Topic: 11340 - Newspaper
Replies: 154
Views: 42980
I used char but I get AC.. I think the problem is not because of that. In the past I got WA because I use int for the cost, after I use unsigned long long to store the value before dividing it by 100, I got AC. I use char and got WA then I change char to unsigned char and got AC. One of my friends ...
Mon Nov 12, 2007 12:22 pm
Forum: Volume 113 (11300-11399)
Topic: 11340 - Newspaper
Replies: 154
Views: 42980
Strange, now I check the range of characters and it was [-128, 127]. Is it possible they correct the input?
Mon Nov 12, 2007 11:41 am
Forum: Volume 113 (11300-11399)
Topic: 11340 - Newspaper
Replies: 154
Views: 42980
but In my compiler I test below code and it was correct: scanf("%d", &n); for (/*cin >> n*/; n--;) { cin.get(); //feeding new line character in scanf("%d", &n) ch1 = cin.get(); ch2 = cin.get(); cout << (unsigned char)ch1 << (unsigned char)ch2 << endl; } or you can write: scanf("%d\n", &n); for (/*ci...
Mon Nov 12, 2007 11:23 am
Forum: Volume 113 (11300-11399)
Topic: 11340 - Newspaper
Replies: 154
Views: 42980

Re: asd

how to used cin.get() ? i used like this for input : 2 av sd scanf("%d\n",&m); long total = 0; while(m--){ unsigned char ch; ch = cin.get(); cout << ch; int cht = (int) ch; } but it prints nothing..and how to check the newline ? thanks. I think you must use cin instead of scanf because cin buffer a...
Mon Nov 12, 2007 9:21 am
Forum: Volume 113 (11300-11399)
Topic: 11340 - Newspaper
Replies: 154
Views: 42980
What input routine should I use then? I can't use the code below since the character can be whitespace (' '): You can use cin.get() method: unsigned char ch = cin.get(); But you must notice cin.get() reads white spaces ('\t', '\r', '\n', ' ') and don't ignore them so you must be careful And accordi...
Mon Nov 12, 2007 9:11 am
Forum: Volume 113 (11300-11399)
Topic: 11340 - Newspaper
Replies: 154
Views: 42980

Re: Easy Fix

Yes, you can read in char !! It just may be negative. Simply add a constant !!! (128 or bigger) Please, remove your code as good etiquette if you get ac. In the contest time they release a clarification: Solution for each test case must be printed on a separate line. I.e. Code: 10.10\$ 10.11\$ Each c...
Sun Nov 11, 2007 8:57 pm
Forum: Volume 113 (11300-11399)
Topic: 11340 - Newspaper
Replies: 154
Views: 42980
I used stl map, got TLE, now switched to simple hash table, got WA 3 times. what is wrong with my code? According to rio's statement: Finally figured out the trick after 20 few submissions.. Character code has range 0 ~ 255, so use unsigned char. Then you can't use string because: typedef basic_str...
Sun Nov 11, 2007 5:50 pm
Forum: Volume 113 (11300-11399)
Topic: 11350 - Stern-Brocot Tree
Replies: 6
Views: 4313
I think you must use unsigned long long instead of int!

Code: Select all

``````struct rat
{
unsigned long long a, b;
};
``````
Mon Oct 08, 2007 10:25 pm
Forum: Volume 113 (11300-11399)
Topic: 11309 - Counting Chaos
Replies: 18
Views: 6736
At last I found your bug! yes in my machine your program for 01:20 output 02:22 as Robert Gerbicz's machine. The problem is in isPal function. You forgot add '\0' in str so after str[3] = s[4]; you must add str[4] = '\0'; and you will get AC. Please after getting AC remove your code Thanks a millio...
Sun Oct 07, 2007 9:33 pm
Forum: Volume 113 (11300-11399)
Topic: 11309 - Counting Chaos
Replies: 18
Views: 6736
When determining if HH:MM is palindromic, ignore all leading zeroes in HH. If HH is zero then ignore all leading zeroes in MM. according to the statement for determining if 01:21 is palindromic, we must ignore all leading zeroes in 01 so we have 1:21. it's obvious that 121 is palindromic. The same ...