| Show all threads Hide all threads Show all messages Hide all messages |
| Why Time Limit? | Ursul Alex | 1020. Rope | 29 Jun 2009 08:10 | 1 |
Hello, guys. Can you tell me, why i got TL for this? #define _USE_MATH_DEFINES #include <stdio.h> #include <math.h> struct Point { float x; float y; }; int main() { freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); int nPins = 0; float pinRadius = 0; scanf("%d %f\n", &nPins, &pinRadius); Point points[101]; for (int i = 0; i < nPins; i++) { scanf("%f %f\n", &points[i].x, &points[i].y); } float len = 2*M_PI*pinRadius; for (int i = 1; i < nPins; i++) { len += sqrt(pow(points[i].x - points[i-1].x, 2) + pow(points[i].y - points[i-1].y, 2)); } len += sqrt(pow(points[0].x - points[nPins-1].x, 2) + pow(points[0].y - points[nPins-1].y, 2)); printf("%.2f\n", len); return 0; } |
| If you use Delphi | Vladislav Ivanishin | 1098. Questions | 29 Jun 2009 05:03 | 1 |
do not forget about {$H+} after debuging ;^) |
| Why Crash? | Tirex | 1001. Reverse Root | 29 Jun 2009 04:19 | 2 |
#include <iostream> #include <iomanip> #include <cmath> using namespace std; int main() { const unsigned int N=32768; unsigned long long xl[N]; unsigned int col=0; cin.setf(ios::skipws); while(cin>>xl[col]) col++; cout.unsetf(cout.flags()); cout.setf(ios::showpoint|ios::fixed|ios::dec); while(col--) cout<<setprecision(4)<<sqrt((double)xl[col])<<endl; return 0; } Decided. Please explain some of the time, please. #include <iostream> #include <iomanip> #include <cmath> using namespace std; typedef unsigned long long Beta; int main() { const unsigned int N=128*1024; Beta *xl=new Beta[N]; int col=0; cin.setf(ios::skipws); while(cin>>xl[col]) col++; cout.unsetf(cout.flags()); cout.setf(ios::showpoint|ios::fixed|ios::dec); while(col--) cout<<setprecision(4)<<sqrt((double)xl[col])<<endl; delete []xl; return 0; } The size of the input stream 256 kb. So we need to allocate memory in the amount of (256*1024)/sizeof(_int64); Why is the correct decision should be 128 * 1024? |
| help, please! What's the reason of WA on the 5th test ? | Vladislav Ivanishin | 1036. Lucky Tickets | 28 Jun 2009 22:51 | 2 |
my program works correctly on all the tests from the forum... //I use long arithmetic and DP sorry = ) I've got it (There was problem when sum = 0) |
| How limit data input? | lyrical_coder | | 28 Jun 2009 13:32 | 1 |
Good morning!There is a task № 1601. http://acm.timus.ru/problem.aspx?space=1&num=1601I can't understand how to limit data input?The condition is that we can see "line feed", but this "line feed" is the end of data input in the function "std::getline". Which of symbols must show whether there is the end of data input excepting "line feed"? There is no explanation in the task what must be this symbol. Edited by author 28.06.2009 13:33 Edited by author 28.06.2009 13:33 |
| Good problem | Gerasim Petrov Velchev | 1422. Fireflies | 27 Jun 2009 14:44 | 1 |
I solved this problem with O ( N ^ 2 lg N) for 1.781 sec :) Just I use finding the angle of every line with Ox, Oy, Oz. Equation of line is WRONG - O ( N ^ 3). #include<iostream> #include<cmath> #include<algorithm> using namespace std; const double eps=1e-9; struct point{long x,y,z;}; struct f { double a,b,c; bool operator==(f x) {return fabs(x.a-a)<eps&&fabs(x.b-b)<eps&&fabs(x.c-c)<eps;} }; double sqr(double t){return t*t;} bool cmp(f a,f b) { if(a.a!=b.a)return a.a-b.a<eps; else if(a.b!=b.b)return a.b-b.b<eps; else return a.c-b.c<eps; } bool cmp1(point a,point b) { if(a.x!=b.x)return a.x-b.x<eps; else if(a.y!=b.y)return a.y-b.y<eps; else return a.z-b.z<eps; } int main() { int n,mxx=-1; point a[2000]; scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d%d%d",&a[i].x,&a[i].y,&a[i].z); if(n==1){cout<<1<<endl;return 0;} sort(a,a+n,cmp1); for(int i=0;i<n-1;i++) { f m[2000]; int k=0; for(int j=i+1;j<n;j++) { double d=sqrt(sqr(a[j].x-a[i].x)+sqr(a[j].y-a[i].y)+sqr(a[j].z-a[i].z)); if(d>0.0){m[k].a=(a[j].x-a[i].x)/d;m[k].b=(a[j].y-a[i].y)/d;m[k].c=(a[j].z-a[i].z)/d;k++;} } sort(m,m+k,cmp); int br1=1,mx=-1; for(int j=1;j<k;j++)if(m[j]==m[j-1])br1++;else{mx=max(mx,br1);br1=1;} mx=max(mx,br1); mxx=max(mxx,1+mx); } printf("%d\n",mxx); return 0; }
|
| WA#5 Can you help me | Zhasulan | 1350. Canteen | 26 Jun 2009 22:08 | 2 |
Maybe you have bug in calculating count of bad products among possible. I had WA #5 on this. |
| where is my mistake | Gevorgyan Aram | 1123. Salary | 26 Jun 2009 22:08 | 2 |
#include <iostream.h> main() {int a,i,b,x; cin>>a; for(i=a; ;i++) {x=i;b=0;while(x!=0) {b=b*10+x%10; x=x/10;} if(b==i) break;} cout<<i; return 0;} |
| 2Admins. please check Test N16. I guess the data is not correct! | Veniamin | 1350. Canteen | 26 Jun 2009 22:02 | 7 |
I receive AV(CRASH) all the time. So, is there are someone who solve this problem on C? Best Regards, Veniamin. Judges, could you share to me this test N 16? Judjes, did you check this test? Edited by author 27.03.2005 22:52 Vladimir, Thanks for answer! Is it possible to get this test? If not, could you give me some hint of this case(which is used in test 16)? Veniamin. I’ve AC. And Test 16 consist of stings with spaces like Aaa bbb Cccccc ccvrfg cv c That was the point! The names can only contain letters and digits by statement. |
| Is the test case wrong? | Debananda Sarkar | 1079. Maximum | 26 Jun 2009 16:31 | 2 |
What will be the output for N=10? For N=10 output is 4. For N=100000 output is 2584. For N=77777 output is 2207. For N=12345 output is 610. For N=5000 output is 322. For N=99999 output is 2584. For N=100 output is 21. For N=50 output is 13. |
| Very bad test, which fails many algos... (+) | Lampabash | 1431. Diplomas | 26 Jun 2009 16:26 | 8 |
How???????? I think that the answer is 3 if you mean: 3 10 3 5 then the answer (accepted) is 3 can't we split the 10 in 6 and 4 and then: 1 row: 6 5 2 row: 4 3 ? No, we can't. You can refer to the problem statement: "A hired designer reckons that all diplomas of the same kind (for example, for winning semifinals) must be in the same row" I think, this comment should be added in statement, because it's easy to confuse, thinking that ALL designer claims were dismissed. It's interest to solve problem if we can split. I have O(2^(3*n/2)) probably right solution using DP of bitmasks. If we have group of k diplomas where no 2 of them cannot be fully situated exactlty in one row, than we can situate these k diplomas in k or k-1 rows. For each bitmask we check, can we situate its k(mask) diplomas in k-1 rows. Than in DP for mask with k bits we check all submasks with size of <=k/2 as first such group. These get us the complicity written before. Надо учесть: И вот последний нанятый дизайнер заявил, что все дипломы одного типа (например, за полуфинальные соревнования) должны висеть в одном ряду |
| Why WA 13?? | WITALIY[UA] | 1073. Square Country | 26 Jun 2009 16:05 | 4 |
Tell my please, why I have Wrong Answer on test number 13 and if it is not problem, tell how I can solve this problem to e-mail WitaliyProg@mail.ru Thanks! Maybe you consider not all cases or some cases are considered incorrectly. Be patient in singular cases. Try this: ------ 1 1 ------ 2 2 ------ 8 2 ------ 12 3 ------ 45 2 ------ 32028 4 ------ 59999 4 ------ 60000 3 ------ 20242 2 ------ 12005 2 ------ 33333 3 ------ 2401 1 ------ 42025 1 ------ 4001 2 ------ 2999 4 ------ 29645 2 ------ 9999 4 ------ 512 2 ------ I had WA #15 in second version of problem (1593) and had wrong in tests like 2^(2k+1)*square. The tests above are on all cases in solution from that version. If you have DP, maybe you have little bug in it. I hope, that these tests will help you. Thanks! I dont use DP. Maybe you can tell me how to make not DP solution? Please... My e-mail WitaliyProg@mail.ru Thanks !!)) |
| How to put in 0.001 second? | 15Sanek15 | 1264. Workdays | 26 Jun 2009 01:44 | 2 |
If you about getting 0.015, now you cannot get less because of system aspects, as I know. If in something way it's about problem, it's easy :) |
| Give advices to the person who has WA#1 | bobchennan | 1081. Binary Lexicographic Sequence | 24 Jun 2009 23:30 | 2 |
It's very easy. TEST#1 is a data which result is -1(It means "no answer"). I submit my program ,and accept! Edited by author 07.05.2009 17:59 Ops, he already found decision=) Edited by author 24.06.2009 23:32 |
| Задача В. Причем здесь площадь 1000000. | Artur Sayapov | 1490. Fire Circle | 24 Jun 2009 17:09 | 14 |
Сабж. Условие не соответствует решению WTF??? And who'll return my 10 submits and lost time??? And still what's the problem with test case 10, when we assume that the board is infinite? i got WA on test 10 anyway, where is the catch? may be answer more than 2^31 ... Well, I don't think this is the problem, because I used long long, and printed it with %lld. Is there a problem with this here in timus? Edited by author 14.10.2006 19:09 r=100000 r=43653 r=2666 Can you please tell the answer? Answers are: 31416325412 (surely more than 2^31) 5986743704 22339576 respectively Thank you very much. My program gives the right answer only for the 3rd test of these 3 but it passed 9 tests :) long long for here is %I64d , and also for some gcc compilers. Please read the FAQ. (However, it's %lld for some) /!!!!\ Result = REAL!!!!! Используйте для подсчёта тип Real.... Я integer использовал и час думал что же у меня не правильно.... Спасибо человеку, который задал вопрос про результаты при больших рабиусах!!! Can you delete it from statement? Вот и мне так кажется. Когда считаю все клетки пападающие в круг и не учитываю ограничение по площади проходит 9 тест но не хватает времени на 10, иначе проходит Wrong Answer на 9. Что это значит??? |
| why i haven't crash on my computer for all tests? | TereshinVS | 1490. Fire Circle | 24 Jun 2009 02:02 | 2 |
I haven't crash on my computer on all tests but have crash floating-point 10... Also my answers r<20000 is right if my brute force is right. sorry for my bad English Do you use int? Maybe you use something sqrt(sqr(int)+sqr(int)), and sqr(10^5)=10^10 makes overflow in int, and you get sqrt from negative number? r is <=100000. |
| I know how to find solution, but not minimal... | Alias (Alexander Prudaev) | 1495. One-two, One-two 2 | 23 Jun 2009 21:26 | 5 |
I write program and get WA3: the number must be minimal. In fact, the matter with this test is someway linked to "Impossible" answer. By the way, finding the minimal solution is easy, searching 2^16-2 sequences is enough. I have TLE#15 using your advice... (( Edited by author 13.05.2007 12:06 you are wrong 2^16 is not enough, even 2^18 The answer for 999999 is 111111222222222222222222222222, which contains exactly 30 digits. Are these special 2^16 or 2^18 sequences? For judges: if you don't have test with 30 digits, include this. |
| TL 21 | Sergei Shteiner | 1579. Coat Transportation | 23 Jun 2009 20:54 | 2 |
TL 21 Sergei Shteiner 10 Mar 2009 20:01 |
| Подсказка к решению или Как показать, что теорема неверна. | Leonid (SLenik) Andrievskiy | 1710. Boris, You Are Wrong! | 23 Jun 2009 19:15 | 2 |
Попытался разобраться как строить треугольник A2B2C2 и случайно додумался вот до такого "доказательства" теоремы Бориса: 0. Дано: A1B1 = A2B2, B1C1 = B2C2, ∠ B1A1C1 = ∠ B2A2C2. 1. По теореме синусов из перечисленного в п. 0 находим, что sin(∠ B2С2A2) = (A2B2 * sin(∠ B2A2C2)) / B2C2 и sin(∠ B1С1A1) = (A1B1 * sin(∠ B1A1C1)) / B1C1. Значит угол ∠ B2С2A2 = ∠ B1С1A1. 2. Соответственно, оставшийся угол A1B1C1 = A2B2C2 (следствие из суммы углов в треугольнике). 3. Теорема доказана! Если найдете ошибку в доказательстве - значит решите задачу ;) Wrong is decision in punct 1. I don't pusblish it, because it will be serious prompting. |
| Anybody knows about MLE#10 | gt11 | 1220. Stacks | 23 Jun 2009 03:12 | 2 |
What's so cool in this test? It pushes a lot into one stack or a lot into many stacks or what? #include <iostream> using namespace std; struct elem { unsigned int value; elem * next; }; elem ** tree; elem * push(elem * stack,unsigned int value) { if(!stack) { stack = new elem; stack->value = value; stack->next = NULL; return stack; } else { elem * temp = new elem; temp->value = value; temp->next = stack; return temp; } } elem * pop(elem * stack,unsigned int & value) { elem * temp = stack->next; value = stack->value; delete stack; return temp; } int main() { tree = new elem* [1000]; memset(tree,0,1000*4); int n; cin>>n; char str[5]; int a; unsigned int b; for(int i = 0;i<n;++i) { cin>>str; if(str[1]=='U') { cin>>a; cin>>b; tree[a-1] = push(tree[a-1],b); } else { cin>>a; unsigned int value; tree[a-1] = pop(tree[a-1],value); cout<<value<<endl;
} }
return 0; } OMG. Changed iostream on stdio.h and it got accepted!! :) 713kb OMG OMG OMG |