| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| WA #4 | Elmi Ahmadov | 1152. Кривые зеркала | 4 апр 2013 13:10 | 3 |
WA #4 Elmi Ahmadov 19 май 2011 17:51 Please give me some tests. I use DFS,but WA4. Edited by author 19.05.2011 17:52 Check this one :-) >> 12 >> 8 8 8 1 1 8 8 8 1 1 8 8 << 68 Edited by author 10.08.2012 14:29 shouldnt the answer be 67 instead of 68? -> 1 1 8 8 8 1 1 8 8 -> 1 1 1 1 8 8 -> 1 1 1 total: 44 + 20 + 3 = 67 ? EDIT: Its my mistake sorry, you are right, after shooting the walls still reamin adjacent even if the adjacent wall is shot. Edited by author 04.04.2013 13:10 Edited by author 04.04.2013 13:10 Edited by author 04.04.2013 13:32 Edited by author 04.04.2013 13:32 |
| Уже сдаюсь. Но моём компе нормально, здесь WA. | Tom | 1001. Обратный корень | 3 апр 2013 23:03 | 4 |
Здравствуйте! Никак не могу понять где у меня проблема. На домашнем компьютере всё нормально работает, но здесь постоянно выдаёт WA. Спасибо #include <stdio.h> #include <math.h> int main(void) { long num; long double arr[100000]; int position = 0; int asnwer; while ( ( asnwer = scanf("%lu", &num)) != EOF ) { if ( asnwer == 1 ) { arr[position] = num; position++; } } position--; while (position >= 0) { printf("%.4f\n", sqrt( arr[position] )); position--; } //getchar(); return 0; } 1. Your code is compiler-dependent: long == int on some compilers, so never use it. Use int or long long explicitly 2. Why do you think 100000 array is enough? Thank you for your answer. 1) Ok, i made it. 2) Actually if i try to raise after 100.000 i get "Runtime error (stack overflow)". So maybe there is some another trick i didn't get. Best regards Use global array to avoid stack overflow |
| 2 admin: why formula does not contain requirement about stable results of sort when teams have the same scores ? | Ozzy | 1100. Таблица результатов | 3 апр 2013 22:51 | 2 |
subj! I could solve this task only when I've seen someone mention about stable results (used TreeSet with comparator, 0.4", 15.5 Mb memory) You should notice that bubble sort mentioned in problem statement is stable |
| Any ideas about test #16? (+) | Vedernikoff 'Goryinyich' Sergey (HSE: АОП) | 1369. Тараканьи бега | 3 апр 2013 21:27 | 3 |
I wrote kd-tree based solution but still TL#16, and I cannot find bad cases for my realization (on my local machine it finishes within 1 sec on any test). Any ideas of what kind of tests may these be? Edited by author 26.03.2013 04:00 |
| i dont understand this bug | shayan shafiee | 1581. Работа в команде | 3 апр 2013 19:56 | 1 |
//please help me to solve this problem //my Bug is between the stars. #include <iostream> using namespace std; int main() { int n,s=1; cin >> n; int a[n]; for( int i=0;i<n;i++ ) { cin >> a[i]; } for( int i=0;i<n-1;i++ ) { if( a[i]!=a[i+1] ) s++; } int b[s][2]; for( int i=0;i<s;i++ ) { b[i][1]=-1; b[i][0]=0; } b[0][0]=1; b[0][1]=a[0]; //************************************************************************** for( int i=0; i<n-1;i++ ) { if( a[i]!=a[i+1] ) { int j; for( j=1;j<s;j++ ) { if( b[j][1]=-1 ) break; } b[j][1]=a[i+1]; b[j][0]++; } else if( a[i]==a[i+1] ) { int j; for( j=1;j<s;j++ ) { if( b[j][1]=-1 ) break; } b[j-1][0]++; } } //************************************************************************** for( int i=0;i<s;i++ ) { cout << b[i][0] << " " << b[i][1]<< " "; } return 0; } |
| 1272. Non-Yekaterinburg Subway | Điền | | 3 апр 2013 16:48 | 1 |
struct graph { int ndinh; int nham; int ncau; vector<EDGE> T; int nT; }; typedef struct graph GRAPH; vector<int> V; int nV; void DocFile(GRAPH &); void Doc(GRAPH &); void InitGraph(GRAPH &); void XacDinHam(GRAPH); int XetLienThong(GRAPH); bool IsCirCle(GRAPH,int); void main() { GRAPH g; ::InitGraph(g); ::Doc(g); ::XacDinHam(g); int kq =::XetLienThong(g); printf("%d\n",kq); } void DocFile(GRAPH &g) { FILE * fo = fopen("MyFile.txt","rt"); if(!fo) { //printf("Khong mo duoc tap tin!!!\n"); return; } fscanf(fo,"%d",&g.ndinh); fscanf(fo,"%d",&g.nham); fscanf(fo,"%d",&g.ncau); g.nT=0; EDGE Temp; while( !feof(fo) ) { fscanf(fo,"%d",&Temp.v1); fscanf(fo,"%d",&Temp.v2); g.nT++; g.T.push_back(Temp); } fclose(fo); } void Doc(GRAPH &g) { int Temp=0; scanf("%d",&Temp); g.ndinh = Temp; scanf("%d",&Temp); g.nham = Temp; scanf("%d",&Temp); g.ncau = Temp; int Temp2=0,Temp3=0; int n= g.ncau + g.nham; for(int i=0;i<n;i++) { EDGE Temp4; scanf("%d",&Temp2); scanf("%d",&Temp3); Temp4.v1 = Temp2; Temp4.v2 = Temp3; g.T.push_back(Temp4); g.nT++; } } void InitGraph(GRAPH &g) { g.nT=0; g.ncau=0; g.ndinh=0; g.nham=0; } bool IsCirCle(GRAPH g,int Index) { if( V.at(g.T.at(Index).v1-1) == V.at(g.T.at(Index).v2-1) ) return true; else { int label1,label2; if( V.at(g.T.at(Index).v1-1) > V.at(g.T.at(Index).v2-1) ) { label1 = V.at(g.T.at(Index).v2-1); label2 = V.at(g.T.at(Index).v1-1); } else { label1 = V.at(g.T.at(Index).v1-1); label2 = V.at(g.T.at(Index).v2-1); } for(int i=0;i<g.ndinh;i++) if( V.at(i) == label2 ) V.at(i) = label1; return false; } } void XacDinHam(GRAPH g) { V.resize(g.ndinh); for(int i=0;i<g.ndinh;i++) { V.at(i) = i; } int nHam=0; int nCau=0; for(int i=0;i<g.nT;i++) { if(nHam!=g.nham) { if( !IsCirCle(g,i) ) { nHam++; } } else { break; } } } int XetLienThong(GRAPH g) { int dem=0; for(int i=0;i<g.ndinh;i++) { int co=1; if(i==g.ndinh-1) { dem++; } else { for(int j=i+1;j<g.ndinh;j++) { if(V.at(i) == V.at(j)) { co=0; break; } } if(co==1) dem++; } } return dem-1; } không biết bị lỗi gì mà chỉ chạy được tới test5. Mong được chỉ giáo |
| So what is test 6? - Runtime Error with C# | NeoTheFox | 1210. Добрые духи | 3 апр 2013 16:46 | 1 |
I dont know if it is my mistake or difference between Mono and Microsoft C#, but it fails at test 6 with runtime error. Is there a way I can know what test 6 is? |
| Weak tests 1515 Cashmaster | Васильев Константин | 1515. Финансовая реформа | 2 апр 2013 23:39 | 2 |
i've got test for this program 3 3 5 9 if answer of my program is "4" site accept my program. But the right answer is "1"!!! is it right? Edited by moderator 03.04.2013 12:40 Test is added. 66 authors have lost AC Edited by author 03.04.2013 12:40 |
| How to do faster I/O using Python, similar to scanf in C++? | Doctor Lai | 1196. Экзамен по истории | 2 апр 2013 20:40 | 1 |
#!/usr/bin/env python from sys import stdin n = int(stdin.readline()) p = [0] * n for i in xrange(n): p[i] = int(stdin.readline()) def chk(s, p, n): left = 0 right = n - 1 while left <= right: mid = (left + right) / 2 if s > p[mid]: left = mid + 1 elif s < p[mid]: right = mid - 1 else: return True return False c = 0 m = int(stdin.readline()) for i in xrange(m): s = int(stdin.readline()) if chk(s, p, n): c += 1 print c The above code is TL8. |
| F1 !!! F1 !!! | Hikmat Ahmedov | 1769. Старая уральская легенда | 2 апр 2013 19:43 | 4 |
Dear colleagues, Can anybody, please, explain me the condition of the problem with simple tests? I didn’t understand given sample. Monks were told to write all the integers starting from the smallest integer that was not a substring of that string. If 11 was the initial string. Assuming integers with leading zeroes are not accepted, monks would start from 0, then 2 (since 1 is a substring of 11) That’s why, if the initial string was 11, monks would have written 02345678910, am I wrong? Could anybody please explain me the condition of the problems? Thanks, The string carved on the stone is 10123456789 and the monks begin writing positive integers that are not a substring of 10123456789. The first string that is not a substring of 10123456789 is 11. The english in the problem is strange.. |
| Something wrong with problems archive :) | MOPDOBOPOT (USU) | | 2 апр 2013 13:00 | 2 |
I see the red "success marks" on many problems that aren't solved :) It was a 1'st April joke :) |
| No subject | Siunov Andrey [AdygheSU-SPbSU] | 1921. В храме Хаоса и Порядка | 2 апр 2013 02:41 | 2 |
No subject Siunov Andrey [AdygheSU-SPbSU] 27 окт 2012 15:07 Руна каждого типа должна присутствовать с уровнем (l-1)? |
| English and Russian are different! To Admin. | coder | 1843. Разрезание параллелепипеда | 1 апр 2013 21:31 | 3 |
"Сперва через пробел записаны целые числа w, d и h (1 ≤ w, d, h ≤ 1 000) — расстояние между передней и задней гранью, между нижней и верхней гранью и между левой и правой гранью, соответственно." w - передней и задней; d - нижней и верхней ; h - левой и правой; ----------------------------------------------------- It contains three space-separated integers, which are distance between front and rear faces d, distance between bottom and top faces h and distance between left and right faces w (1 ≤ d, h, w ≤ 1 000). here: d - front and rear (передней и задней) h - bottom and top faces (нижней и верхней) w - left and right faces (левой и правой). Edited by author 04.04.2012 14:39 Здесь, только буквы неправильном порядке написано! Сорри! А пространство в котором находиться куб, int-ое или c плавающей точкой? A space in which to be a cube, int or float? |
| Help Needed...WA12 thanks a lot! | Doctor Lai | 1185. Wall | 1 апр 2013 19:44 | 1 |
What is wrong with this code program Project4; {$APPTYPE CONSOLE} {$M 16777216} uses Math; type Pt = record x, y: integer; end; float = Extended; function left(const p1, p2, p3: Pt): boolean; inline; begin Result := ((p2.x - p1.x) * (p3.y - p1.y) - (p2.y - p1.y) * (p3.x - p1.x)) > 0; end; function dist(const p1, p2: Pt): float; inline; begin Result := Sqrt(Sqr(p1.x - p2.x) + Sqr(p1.y - p2.y)); end; var ans: float; i, n, l, j: integer; p, s: array[1..1001] of Pt; pointOnHull, endPoint: Pt; begin Readln(n, l); pointOnHull.x := 1000001; pointOnHull.y := 1000001; for i := 1 to n do begin Readln(p[i].x, p[i].y); if (p[i].x < pointOnHull.x) then begin pointOnHull := p[i]; end else if ((p[i].x = pointOnHull.x) and (p[i].y < pointOnHull.y)) then begin pointOnHull := p[i]; end; end; j := 1; repeat s[j] := pointOnHull; endPoint := p[1]; for i := 2 to n do begin if (((endpoint.x = pointOnHull.x) and (endpoint.y = pointOnHull.y)) or (left(p[i], pointOnHull, endpoint))) then begin endpoint := p[i]; end; end; Inc(j); pointOnHull := endPoint; until (endPoint.x = s[1].x) and (endPoint.y = s[1].y); ans := dist(s[1], s[j - 1]); for i := 2 to j - 1 do begin ans := ans + dist(s[i], s[i - 1]); end; ans := Round(ans + 2 * PI * l); Writeln(ans:0:0); {$IFNDEF ONLINE_JUDGE} Readln; {$ENDIF} end. This uses 'gift-wrapping' algorithm described in http://en.wikipedia.org/wiki/Gift_wrapping_algorithmbut it can't pass test 12. As you can see, I use 'extended', so it is not problem of precision. Edited by author 01.04.2013 19:45 Edited by author 01.04.2013 19:47 |
| Help | UJOP-Leo | 1197. Один в поле воин | 1 апр 2013 19:43 | 3 |
Help UJOP-Leo 30 мар 2013 01:59 What's wrong with this code? var i,n,num:integer; ch:char;st:string; begin readln(n); for i:=1 to n do begin readln(st); num:=ord(st[2])-ord('0'); ch:=st[1]; if ((ch='a')or(ch='h')) then begin if ((num=1)or(num=8)) then writeln(2) else if ((num=2)or(num=7)) then writeln(3) else if num in[3..6] then writeln(4); end else if ((ch='b')or(ch='g')) then begin if ((num=1)or(num=8)) then writeln(3) else if ((num=2)or(num=7)) then writeln(4) else if num in[3..6] then write(6); end else if ((ch='c')or(ch='d')or(ch='e')or(ch='f')) then begin if ((num=1)or(num=8)) then writeln(4) else if ((num=2)or(num=7)) then writeln(6) else if num in[3..6] then writeln(8); end; end; end. I've tested all 64 cases and it works, but i still get WA2. Edited by author 30.03.2013 02:00 Re: Help Vincas Stonys 30 мар 2013 04:33 else if num in[3..6] then write(6); should be writeln(6). everything else is fine ;) |
| How to solve it in O(n^2) without gcd? | Victor Barinov (TNU) | 1422. Светлячки | 1 апр 2013 15:34 | 4 |
Hi! I am trying to solve this problem with hashing, but my method use gcd so the complexity is O(n^2 log n). What hash-function i must use for hashing vector (vx,vy,vz)? I used the following: abs(dx) + 5*(abs(dy) + 5*dz) dz >= 0 always, for dz=0 dy>=0 always, for dz=0 and dy=0 dx>=0 always It is base-5 representation of |dx|, |dy|, |dz|. 5 is a good multiplier because it may turn into LEA EAX, [EAX*4+EAX] in assembler which is pretty fast. I still had TL18 when I ran main loops for 1..n x 1..n. Then I changed algo to run for 1..n x i+1..n, and got AC in 1.7 sec. No floats or int64. But function (dx,dy,dz) -> abs(dx) + 5*(abs(dy) + 5*dz) is not biection I didn't get it. Could you explain more? |
| Binary GCD | OZone | 1422. Светлячки | 1 апр 2013 15:33 | 1 |
My integral implementation finally got AC. For those who struggle with TL#9, you could change binary GCD to plain Euclidian algorithm with modulus, strangely it is a way faster despite it uses division. Edited by author 02.04.2013 02:31 |
| 1st April Accepted is more than just one Accepted :-) | Problemset Maintainer | | 1 апр 2013 11:43 | 1 |
|
| THe same code ,G++ 4.7.2 C++11->WA G++ 4.7.2->AC why? | binwin20 | 1294. Марсианские спутники | 31 мар 2013 09:12 | 1 |
1294. Mars Satellites G++ 4.7.2 Accepted 0.015 345 KB 1294. Mars Satellites G++ 4.7.2 C++11 Wrong answer 1 0.015 369 KB |
| Solution | pkl | 1017. Лестницы | 30 мар 2013 23:08 | 3 |
/* Q[n][h] contains the number of staircases from n bricks with height h */ unsigned long long Q[MAX_N+1][MAX_N]; -- Data structures, not algorithms, are central to programming. Solution Aganov Artur [Barnaul] 12 окт 2011 21:27 The only structure DP solution uses is DP matrix. |