| Show all threads Hide all threads Show all messages Hide all messages |
| Hint | Karthic | 1196. History Exam | 21 Jan 2012 20:16 | 1 |
Hint Karthic 21 Jan 2012 20:16 With linear search you'd get TLE. Go for Binary search!! |
| No subject | ONU_1785 | 1132. Square Root | 21 Jan 2012 05:46 | 1 |
Edited by author 31.01.2012 21:26 |
| WA7!! | Moein Fatehi | 1688. Team.GOV! | 21 Jan 2012 02:38 | 3 |
WA7!! Moein Fatehi 21 Sep 2011 21:12 I have wrong answer in my 7th testcase! can you tell me Why? bcs of wrong data types u need 8-byte data type 4-byte are useless my program crashed even on 3rd Edited by author 06.10.2011 03:33 Solved... I forgot that m can be Zero! |
| WA#7 | Adrian | 1200. Horns and Hoofs | 20 Jan 2012 19:10 | 2 |
WA#7 Adrian 30 Aug 2008 17:46 can anyone here tell me the test data for test#7? and thanks tell me please the data for this test Edited by author 20.01.2012 19:11 |
| No tests with >256 characters? | PrankMaN | 1354. Palindrome. Again Palindrome | 20 Jan 2012 15:19 | 2 |
I used pascal strings and got AC. From description: "Strings can be longer than 255 characters.". So tests can content strings with length more than 256 characters. |
| 2all! | Stupnikov Pavel | 1093. Darts | 20 Jan 2012 02:02 | 3 |
2all! Stupnikov Pavel 23 Aug 2004 23:14 This problem does NOT have any special cases. It is just a formula and its CAREFUL implementation. Agree!I had suppose I would get "Wrong Answer" several times,but I got "Accepted" at the first submit. it has 2 special cases. to get ac you should guess that touching surface of the target is "hit", but touching it's border is "missed". |
| In my opinion there is problem in tests.Because | Qafqaz_Ferhad Cebiyev | 1644. A Whole Lot of Walnuts | 20 Jan 2012 00:28 | 4 |
char x[100] -- is Wa while char x[101] -- is AC If you think that n > 100 in some tests, you can write in your program: if (n > 100) for(;;); If some test is incorrect you will get "Time limit exceeded" on this test. But in all tests in this problem n <= 100. So there is a problem in your program, not in tests. c/c++ array size is kind of not stable. For string-related problem, i prefer pascal A C-string uses 1 additional symbol (with number 0) as the end of line. So u have to create an array with 100+1=101 symbol. |
| How can we get 0.031 or 0.046? | ONU_1785 | 1048. Superlong Sums | 19 Jan 2012 20:08 | 1 |
I got 0.218, 104Kb with this code: #include <cstdio> #include <cstdlib> int main() { char str[8]; gets (str); int n=atoi(str); char s,sum=0;
int count=0;
while (n) { gets(str); s=str[0]+str[2];
if (s==105) {putchar(57); --n;} else {sum=s; --n; break; } } if (!n) return 0;
for (int i=0; i<n; ++i) { gets(str); s=str[0]+str[2]; if (s==105) {++count;} else {
if (s<=104) { putchar(sum-48);
for (; count>0; --count) putchar(57);
sum=s;
} else { if (s>=106) { putchar(sum-47);
for (; count>0; --count) putchar(48);
sum=s-10;
} } } }
if (s==105) { putchar(sum-48);
for (; count>0; --count) putchar(57);
} else if (sum)
(s>=106)?putchar(s-58):putchar(s-48); } Could anyone tell me what should i do to make it faster? |
| Funny error | Lukom | 1012. K-based Numbers. Version 2 | 19 Jan 2012 14:50 | 4 |
I make problem 1012 with long ariphmetic, but got WA #6 During some time I searched an error, and she appeared interesting: in each slot of array I wrote down 7 numbers. For example number 76192801046017773930 (n=20, k=10) in my array looked so: a[]={7773930, 104601, 761928, 0, ... 0} but as you see the second (104601) number has 6 numbers: it must look so 0104601, and the first zero did not hatch. Through this my number looked so 7619281046017773930. errors are different... :P Thank you very much! With your help,I get AC now! Thanks a lot,at the first time I want decrease the cost of memory so I used each four digits to represent one digit,but this compression also take the number a mistake,when it should get an output for 0146,the program output an 146,it lost some digits~~~~~ |
| Need test cases - 1020 Rope Problem | Karthic | | 19 Jan 2012 00:47 | 1 |
Can anyone post some test cases for 1020 Rope problem? My code works fine for the test cases that I created. But getting #WA Edited by author 19.01.2012 00:47 Edited by author 19.01.2012 00:48 |
| Could 1698 be solved faster than O(N^2) | DK [Samara SAU 1: X2008] | 1698. Square Country 5 | 19 Jan 2012 00:42 | 3 |
My solution (without answers precalculation) is about O(N^2). How could it be solved faster? I wonder the solution within O(n^2) without cheating. Yes there is. You must solve this mathematically. Solution: Let find all numbers of length 2.Let a is automorphic number then a * (a - 1) = 0(mod 100). Then we know that a and (a - 1) is coprime this fact gives us two cases : 1)a is multiple of 25=> a = 25 * q and (a - 1) is multiple of 4 => a - 1 = 4 * p => 25q - 1=0(mod 4) => 25q = 1(mod 4) then we must find such v s.t. 25 * v = 1 (mod 4), but we know that 4 and 25 coprime => such v exists moreover we can find it use extended Euclid algorithm. In this case v = 1 because 25 * 1 = 1 (mod 4). Then we have (25 * v) * q = 1 * v(mod 4)=> q = 1(mod 4) => q = 1 then a = 25 * q => a = 25-is automorphic number. 2)(a - 1) is multiple of 25 and a is multiple of 4. a = 25q + 1 then use idea described above we find that q = 3 => 25 * 3 + 1=76- is automorphic Using this idea we can find all automorphic numbers which length is <= then given n ! |
| WA16... Need help | 3a[3.141592..]Jlu | 1419. Maps of the Island Worlds | 18 Jan 2012 23:48 | 2 |
I've got wa16 :( Please give me some useful tests. In test 16 there is a other simbol that not is 'O','-','|','/','\',' '. the answer is no. Sorry for poor Engilsh. |
| If you have WA2 | Victor Barinov (TNU) | 1583. Cheese | 18 Jan 2012 21:56 | 3 |
I got WA2, when used usual rounding. And when i rounded all my cuts to the smallest grater than one than get AC. I used usual rounding. But after each cut next 500g I measure not from ideal cut line, but from real cut line, taking into account accuracy of cutting machine. tricky: needVolume = 500.0; while (needVolume < <total volume> ) { <find y> iy = round(y) recalc volume, from 0.. to iy position.(v). needVolume = v + 500.0 } |
| WA#6 | IgorKoval(from Pskov) | 1008. Image Encoding | 18 Jan 2012 21:51 | 1 |
WA#6 IgorKoval(from Pskov) 18 Jan 2012 21:51 In test #6 we must write 2nd representation in 1st. This get WA6 while( 1 ){ string cur; getline( cin, cur ); if( cur == "." ) break;//!!!!!!! pT p = Q.front(); Q.pop_front(); IsBl[p.x][p.y] = true; <secret deleted code here =) > } This get AC: while( 1 ){ string cur; getline( cin, cur ); pT p = Q.front(); Q.pop_front(); IsBl[p.x][p.y] = true; if( cur == "." ) break;//!!!!!!! <secret deleted code here =) > } PS: sily mistake. Edited by author 18.01.2012 21:52 |
| To everyone : Algorithm to solve this problem ! Very easy ! | Phan Hoài Nam - Đại học Ngoại ngữ Tin Học TP.HCM | 1296. Hyperjump | 18 Jan 2012 20:58 | 4 |
calculate : fmax(n) = max(fmax(n-1)+value(n),value(n)); Why? Consider p1 = 5, p2 = -2 fmax(1) = 5 fmax(2) = max( 5+(-2), -2 ) = 3 But if i = j = 1 fmax(2) = 5 Or I got wrong understanding of the task? F[i] is max values of sequence with the final element is a[i]. Finally, answer will be max( F[1], ... F[n] ). Sorry because of English. It's wrong algorithm and more hard than right. |
| WHY QS Do not work??? | BaJIuK | 1656. Far Away Kingdom's Army | 18 Jan 2012 18:36 | 1 |
|
| tle on test 5 please help pascal | amirani | 1796. Amusement Park | 18 Jan 2012 17:50 | 1 |
var i,k,j,p,min,q,x,n:integer; a,b:array [1..6] of integer; c:array [0..6] of integer; t:boolean; begin min:=32000; a[1]:=10; a[2]:=50; a[3]:=100; a[4]:=500; a[5]:=1000; a[6]:=5000; n:=6; for i:=1 to n-1 do begin read (b[i]); x:=x+b[i]*a[i]; end; readln (b[n]); readln (k); t:=false; i:=1; while not t do begin while (i<=n) and (c[i]>=b[i]) do begin c[i]:=0; inc(i); end; if i>n then begin t:=true; continue; end; inc(c[i]); for j:=1 to n do p:=p+c[j]*a[j]; if p=k then begin q:=p; break; end; if p>=k then begin for j:=1 to i-1 do c[j]:=0;
end else i:=1; if (p>=k) and (p-k<min) then begin min:=p-k; q:=p; end; end; q:=(x-q) div k; writeln ((x div k)-q); for i:=q+1 to x div k do write (i,' '); end. |
| what is wrong with this code it is giving correct output | garra | 1068. Sum | 18 Jan 2012 08:42 | 1 |
#include<stdio.h> #include<stdlib.h> #include<math.h> int main() { int s,i,sum=0; scanf("%d",&s); if(abs(s)<10000) { if(s>0) { for(i=1;i<=s;i++) { sum=sum+i; } printf("%ld",sum); } else { for(i=1;i>=s;i--) { sum=sum+i; } printf("%ld",sum); } } return 0; } |
| Does any body know test #3? | Sid | 1045. Funny Game | 17 Jan 2012 16:58 | 7 |
I got WA#3 and can't anderstand why... Edited by author 08.04.2005 22:01 Here it is: 11 8 1 3 1 2 2 4 4 5 4 6 2 8 8 9 8 7 9 10 10 11 Thank you guys! In fackt I didn't anderstand task correctly... But now I got AC Edited by author 08.04.2005 22:02 11 8 1 3 1 2 2 4 4 5 4 6 2 8 8 9 8 7 9 10 10 11 ans: First player wins flying to airport 2 But I still can't understand why WA. Your answer is inccorect! answer mus be: First player wins flying to airport 3 "If there are several such airports, the program should find one of them that has the minimal number" But 2 is less than 3. So why not to fly to airport number 2? 2 is the correct answer my answer is 2 and my program is Accepted |
| Reg test suite for problem 1027. D++ Again | hariprasad.puvvadi | 1027. D++ Again | 17 Jan 2012 16:39 | 1 |
Is there any link where I can access\download the input test vectors for problem "1027. D++ Again" ? -Hari |