| Show all threads Hide all threads Show all messages Hide all messages |
| why i got Crash (ACCESS_VIOLATION)??????????????????Can you help me? | arthur | 1077. Travelling Tours | 12 Dec 2024 20:06 | 3 |
CODE IS HERE; #include "stdio.h" #include "string.h" long a[401][401]; long n,h,t; long i,j,m; int c[500]; int p[500]; long count=0; void bfs(int i) { int k; for(k=1;k<=n;k++) { if(c[k]==0) { if(a[i][k]==1) { a[i][k]=0; a[k][i]=0; c[k]=1; p[k]=i; bfs(k); } } } } void path(int a1,int a2) { int q[500]; int i=0; while(1) { q[i]=a2; i++; a2=p[a2]; if(a2==a1) break; } printf("%d",i+1); printf(" %d",a1); while(i>0) { printf(" %d",q[i-1]); i--; } printf("\n");
}
void main() { for(i=0;i<401;i++) for(j=0;j<401;j++) a[i][j]=0; scanf("%ld %ld",&n,&m); for(i=0;i<m;i++) { scanf("%ld %ld",&h,&t); a[h][t]=1; a[t][h]=1; } for(i=1;i<=n;i++) c[i]=0;
c[1]=1; bfs(1);
for(i=1;i<n;i++) { for(j=i+1;j<=n;j++) if(a[i][j]==1) { count++; } } printf("%ld\n",count); for(i=1;i<n;i++) { for(j=i+1;j<=n;j++) if(a[i][j]==1) { path(i,j); } }
} I have same problem and increased answer's array. got AC Try this 7 8 1 2 2 6 1 6 4 6 4 3 3 5 5 6 3 7 |
| WA#10 | Artem Khizha [DNU] | 1486. Equal Squares | 11 Dec 2024 16:38 | 5 |
WA#10 Artem Khizha [DNU] 26 Jan 2011 03:53 At the moment my way is to look through all the squares of length LEN (using binary search) and to check, whether a hash of a square was met before. It is of O(N*M*log(min{N, M})) complexity. But I get WA#10 again and again. Please, if someone had a problem with this test, share your impressions, 'cause I'm going slightly mad. You have a collisions with hash. (I've got this problem also because second number x was to small and close to first one). Re: WA#10 Artem Khizha [DNU] 5 Jul 2012 16:29 Thank you, it really had to do with collisions. Actually, my self-made hashset implementation was fantastically awful. :-) Edited by author 06.07.2012 15:48 Why you have used binary search? How we can say that the sq. matrix 2x2 has less value than 3x3. and 3x3 has less than 4x4. how can we justify? We run a binary search on the length of the square's side. For a fixed length of the square's side, we calculate the hash of all squares with that side length, and look for a pair of squares with the same hash. |
| wa on 3 | Roman | 2133. Terms of reference | 8 Dec 2024 23:10 | 2 |
got WA on 3, why, have any tests? Edited by author 14.03.2024 17:39 Try this: 7 3 6 5 2 6 1 4 4 2 1 1 6 4 1 4 10 2 1 Answer: 1 1 |
| easy max flow | ~'Yamca`~ | 2089. Experienced coach | 8 Dec 2024 14:52 | 2 |
Overkill, just dfs is enough) |
| Nice prob | daftcoder [Yaroslavl SU] | 1873. GOV Chronicles | 6 Dec 2024 01:49 | 2 |
Nice prob daftcoder [Yaroslavl SU] 22 Oct 2011 16:01 5 plus 1 plus 1 plus 1 plus 1 plus 1 plus 3 plus 1 plus 1 plus 1 plus 1 plus 1 plus 1 is ... 19!!!!! NINETEEN!!!1111!! FFFFUUUUU~~~~~ Okay, have to read prob statement again. :D You could have used brute force ;) |
| Please clarify. | Dmi3Molodov | 1080. Map Coloring | 30 Nov 2024 21:32 | 1 |
Прошу уточнить. В задании (и тестах) идёт речь о: 1) конечных географических 2D картах. 2) географических картах на сфере. 3) любых абстрактных картах в многомерном \ многосвязном пространстве. 4) другое. Please clarify. The task (and tests) are about: 1) Finite 2D geographical maps. 2) geographical maps on the sphere. 3) favorite abstract maps in a multi-dimensional \ multi-connected space. 4) other. |
| Strange rating/summary results | Oleg Vasilenko (Chelyabinsk) | | 30 Nov 2024 15:12 | 4 |
Admins, please look at this issue. I suppose it is mistake (or bug in rating system), that I became 1st place in rating solved same number of tasks as ACRush, but did it only in 2024 year, i.e. later. Suppose that rating must be the same and my place is 2nd. Looks like integer overflow :)) When I resubmitted one single AC solution (for 1394 task) - rating summary has changed again and now I got about 200 points of rating less than 1st place. Edited by author 18.11.2024 22:09 Congrats on solving all the problems! |
| YES or NO? | Dmi3Molodov | 1021. Sacrament of the Sum | 29 Nov 2024 01:29 | 1 |
test: 1 10000 0 How do I answer "YES" or "NO"? ooopsss! Zero not allowed! Sorry. Edited by author 29.11.2024 01:34 |
| Прикол!!! | Shady TKTL | 1012. K-based Numbers. Version 2 | 24 Nov 2024 02:48 | 9 |
когда я с длинной арифметикой сделал эту задачу я использовал в качестве основы 10000 и у меня был WA#7 тест потом я сделал снову 10 и у меня был WA#2 тест тогда подумав решил использовать EXTENDED всеравно WA#6 тест кто подскажет как преодолеть 2, 6, 7 тесты Use base = 10 compare small answers with 1009 I compaired it My program gives equal answers in all cases Use Java's BigInteger I always use it then long arifmetic is needed. Помоему он подсовывает во 2 тесте N=170 и K=10 Если умножать пллучается 10 с 170 нулями. Никакой тип не выдержит. Надо разбивать число на группы. Только какие? Edited by author 11.06.2008 17:47 174568663359808123517619015636369512622213 064344534689513998708986681415716975079951 752754958954321404709642918328732491072229 658639887075761909680804620151071937764270 946419913401 Edited by author 29.10.2008 11:30 Пока не использовались ostream манипуляторы setfill('0')\setw(9) а использовались только fill('0')\width(9) программа не выводила ведущие нули. AC https://acm.timus.ru/getsubmit.aspx/10809916.cppWA7 https://acm.timus.ru/getsubmit.aspx/10809884.cppЛибо я что-то не понял, либо это ошибка в STL. Надо чтобы админы проверили. P.S. My English is too bad. Понял. Не ошибка STL. Фича. В документации написано (на ангельском языке): Глобально установленная ширина поля имеет право портиться. Edited by author 25.11.2024 04:43 |
| Why so easy? | Timur | 1731. Dill | 19 Nov 2024 22:44 | 1 |
|
| Wa is re | 👑TIMOFEY👑`~ | 1861. Graveyard in Deyja | 19 Nov 2024 16:02 | 1 |
If you have an absolutely useless piece of code in your code that is not used anywhere, but it has an error going out of bounds, then this may instead affect the execution of the rest program |
| Hint about wa 9 | Hououin`~`Kyouma | 1357. Teakettle 1.0 for Dummies | 15 Nov 2024 19:55 | 1 |
Round(time) instead of Ceil(time) |
| WA in test 5 | Daniel | 1215. Exactness of Projectile Hit | 14 Nov 2024 23:24 | 1 |
What should i check if i have WA in test 5? |
| Am I using correct approach? | sleepntsheep | 1632. Lasers | 14 Nov 2024 16:59 | 1 |
|
| Hint about ml 3 | Hououin`~`Kyouma | 1097. Square Country 2 | 12 Nov 2024 20:37 | 1 |
Delete a rectangle if there is another one covering this one |
| Why does a simple sort of pairs + finding the median not work? | sweepea | 1207. Median on the Plane | 12 Nov 2024 14:43 | 2 |
All the test cases I've come up with have been solved correctly by this method but no AC :( code: ``` #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<vector<int>> x(n, vector<int>(3, 0)); for (int i = 0; i < n; i++) { cin >> x[i][0]; cin >> x[i][1]; x[i][2] = i + 1; } sort(x.begin(), x.end()); auto med = (n - 1) / 2; cout << x[med][2] << " " << x[med + 1][2]; } ``` Edited by author 11.11.2024 16:23 Edited by author 11.11.2024 16:23 To answer my own question. The above code will select for the 2 median points. These don't necessarily create a median line. Consider the following test case: 4 0 10 1 1 2 2 3 10 The above alogorithm would select (1, 1) and (2,2), which partitions the plane into a section with 2 points, and a section with 0 points; the above approach is incorrect. |
| for All of Programmers | Adhambek | 1642. 1D Maze | 11 Nov 2024 19:09 | 8 |
Test 3 : input : 5 2 -1 -2 -3 -4 -5 output : 2 4 Test 4 : input : 2 0 1 -5 output : 0 0 Test 5 : input : 15 23 252 33 215 789 1000 123 -125 29 -45 -450 121 -555 -72 120 123 output : 23 113 Test 6 : 0 213 output Impossible Test 7 : input : 8 12 1 2 3 4 5 6 7 8 output : Impossible Test 10 : input : 0 0 output : 0 0 Test 15 : input : 2 12 1000 -1000 output : 12 2012 Тест 4 точно не такой. По условию сказано, что x!=0. Я проверял, во всех тестах x!=0. Тест 10 тоже не такой. Edited by author 28.01.2014 07:04 Edited by author 28.01.2014 07:05 правильно подметил Vitaliy. Еще возможен такой вариант : input : 3 2 0 -2 4 output : Impossible Невозможен, "Все координаты, включая x, не равны нулю" You have an error in tests 4 and 10: "Each coordinate, including x, is non-zero and doesn't exceed 1000 in absolute value." 15 isn't it. I have WA15, but on this test my program outputs right answer |
| Hi read this!!!!!! | Turdubek | 1025. Democracy in Danger | 11 Nov 2024 03:05 | 2 |
Send me the answer or I'll kick you! |
| Куда делась задача 1785 ? | Oleg Vasilenko (Chelyabinsk) | | 9 Nov 2024 20:19 | 3 |
Почему задачу 1785 нельзя отправить на проверку и почитать её условие, однако она идёт в зачет количества решенных задач? Чтобы новые пользователи никогда не могли решить все задачи? Так что ли? Thanks for raising the issue. The problem is restored. |
| [TO ADMINS] Rust compiler: edition 2021 | Yury_Semenov | | 9 Nov 2024 17:50 | 5 |
Hi, I've got a compilation error in Rust (id: 10760679) because of a feature that appears in edition 2021, and the compiler on Timus uses some previous edition. Any plans to compile Rust code in edition 2021? It's already 2024 and the edition is stable (in fact, a newer edition will be released in several months), so it makes no sense to stick to an older edition. The current version of Rust compiler is 1.75.0, which was released on 28 December, 2023. Thanks for explanation. The command line changed to: rustc -O --edition 2021 %1 |