| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| on drugs | MARAZ MIA | 1083. Факториалы!!! | 13 окт 2020 18:41 | 1 |
for n=2,k=3 ans=2*(2-3)*(2-6)*(2-9)*..... The author must include the condition that n>=k.. |
| O(n^3) accepted fairly easy | Tabledott | 1052. Охота на зайцев | 13 окт 2020 05:00 | 3 |
I coded O(n^3) that was accepted fairly easy... But I know there is O(n^2) algo but I don't know how to implement it.. Any Ideas? Yaa i have the idea of O(n^2).First you can can calculate the slopes of all lines in O(n^2).Create a class which contains the 2 points and the slope of the line joining two points.Note that there will be n(n+1)/2 nodes and define operator == as: slopes are equal and one point must be common to both the lines. I have tl with long double and wa with double on that O(n^2) solution Edited by author 13.10.2020 05:01 |
| Что курил, автор, лол? :DDD | D4nick | 1283. Гномик | 13 окт 2020 01:25 | 1 |
|
| VERY SIMPLE SOLUTION. | c_pp | 1102. Странный диалог | 13 окт 2020 00:29 | 3 |
There only 10 situations!!!!! //1. in //2. input //3. inputon //4. inputone //5. out //6. output //7. outputon //8. outputone //9. puton //10. one Check their in inverse order. bool check(char const* s){ while(*s != '\n'){ if (s == "one") s += 3; // there s == "one" only pseudocode, you may check // as memcmp(s, "one",3) == 0 else // ...... //............. // 10 times else else if (s == "in") s +=2; else return false; } return true; } thnx a lot c_pp atleast i learn something |
| Funny question | guilty spark | 1640. Кольцо холода | 12 окт 2020 00:08 | 1 |
what a question haha. just read the question carefully |
| Optimize my recursion solution | Hadji | 1152. Кривые зеркала | 9 окт 2020 17:36 | 1 |
I got tl5 using recursion solution, and i dont know how to optimize it. Please give me some hints how to solve it better |
| How can this be solved? Can anyone help?(+) | asif | 1227. Чемпионат по ралли | 8 окт 2020 20:56 | 11 |
Is there any polynomial time solution? I can WAZZAP 14 ноя 2002 16:52 > Is there any polynomial time solution? yes. - if there is a cycle the answer is always "yes" - if there is a knot (ex. 2 2 edges), the answer is also "yes" - if graph is multigraph, yes too if all above is false just find the longest path in a tree and play with it's value in comparsion with route length > > Is there any polynomial time solution? > yes. > > - if there is a cycle the answer is always "yes" > - if there is a knot (ex. 2 2 edges), the answer is also "yes" > - if graph is multigraph, yes too "multigraph" : what is it? I got WA so many times,any trick? > > if all above is false just find the longest path in a tree and > play with it's value in comparsion with route length > > Thanks. I did not read the question well enough and thought that the race must start and end on vertices. How stupid of me! That is why I asked that stupid polynomial question. > > > Is there any polynomial time solution? > > yes. > > > > - if there is a cycle the answer is always "yes" > > - if there is a knot (ex. 2 2 edges), the answer is also "yes" > > - if graph is multigraph, yes too > "multigraph" : what is it? I got WA so many times,any trick? > > > > if all above is false just find the longest path in a tree and > > play with it's value in comparsion with route length > > > > Edited by author 23.07.2008 05:54 > "multigraph" : what is it? I got WA so many times,any trick? multigraph can have more than one edge connecting 2 vertices. Those edges can have different length. So, if there are two or more edges, connecting 2 vertices, this is just another cycle. This task is quite tricky and not well-right from the point of diskrete maths. For example, non-oriented graph can not have knots (by the difinition), but in this problem this is one of the "triks". but how to judge whether there's a cycle? do DFs and if there a return edge than u have a circle or do n Dijkstra's and if u can get back to the point than u have a circle I can't understand why if there is cycle, the answer is always yes -> what about this test: 3 3 1000 1 2 3 2 3 3 1 3 3 Edited by author 21.07.2009 12:43 Why YES? Petr Huggy (Pskov) 21 ноя 2010 12:32 Because there is a cycle with length 9, and we can ride this path unlimited number of times. "The race may start and finish anyplace on the road" |
| Hint | frochbg | 1034. Ферзи в мирной позиции | 8 окт 2020 13:15 | 2 |
Hint frochbg 3 окт 2020 13:37 I have been trying to solve this problem for several days, but suddenly I ran out of ideas. Could you give me some hints on the task? I have tried brute force and some pruning, but it got TLE. I would be really happy! :) I've got AC! The main observation is that no two queens can be in the same row or column. Thus, we make an array perm[i], which stands for queen in the ith row and perm[i]th column. The problem is to find the number of permutations, which differs from the initial by 3 elements and check for each possibility whether we have conflicts on the diagonals. perm[i] is the initial permutation. I hope this hint was helpful! |
| help test19 | marlen200186 | 1208. Соревнование легендарных команд | 8 окт 2020 00:26 | 1 |
|
| Test4 | Nadezhda | 1134. Карты | 7 окт 2020 20:45 | 5 |
Test4 Nadezhda 9 ноя 2013 17:52 Please, tell me what is in Test4??????? I also got WA for test 4.....so I started to try some self made test cases.....and I came across this one : 5 4 2 0 1 3 My output : NO. Correct Output should be YES. I will have to rethink my approach.....maybe you have the same problem as well. case 3 3 1 2 3 helped me in test 4. But anyway it's better to write your own test case generator. Edited by author 18.04.2020 04:47 |
| It’s a very practical problem. | Sultana Razia | 1638. Книжный червь | 6 окт 2020 07:08 | 1 |
I did not understand this problem firstly .But after 3rd trial i get amused!. |
| Interesting Problem it is...! | ইলহাম আল মুসাব্বির | 1638. Книжный червь | 6 окт 2020 07:04 | 2 |
Read the problem statement carefully. Its a very realistic,practical and easy problem. Draw a picture to help yourself for finding the solution. Keep in mind that the worm will move leftwards or rightwards from its initial position according to input of starting volume and ending volume. It is also possible that the worm started and ended in the same volume... Happy Coding...:) First i did not understand this problem.but your suggestions help me.thanks!!!And it is really very practical, realistic and easy problem!! |
| Runtime error из-за чего эта ошибка? | German | 1293. Эния | 5 окт 2020 22:06 | 1 |
a=float(input()) b=float(input()) c=float(input()) k=a*b*c*2 print(k) |
| I can't understand the problem's statement | Bahturin Alexander (SibSUTI) | 1638. Книжный червь | 5 окт 2020 18:46 | 6 |
If the worm starts from the first sheet of the first volume and finishes at the last one of the second volume, how could the answer for the sample input be 2, given that the thikness of the book (not including the cover) is 10? Worm can move both left and right. Stop for a while and think about it. In some languages, the "first page" of a book is on the left side of the book when the book is placed on a shelf. In which case "10 1 1 2" == 22. Just take two books and try - you will find answer immediately I fully agree with you.How could the answer for sample input be 2. |
| The sample output may not be correct. | Rotter Tarmination | 1058. Шоколад | 3 окт 2020 16:23 | 1 |
I have got AC on this problem. In the description, it says "accuracy to 0.0001". In the code which I submitted, I use printf("%.4lf\n", min_breakage); to match the point. When I use the sample input, my output is 3.0000. But the sample output is 3. So I think the sample output may be wrong. Or both the two outputs are correct? |
| MLE 14 | Levon Oganesyan | 1971. Настройки графики | 3 окт 2020 01:35 | 1 |
MLE 14 Levon Oganesyan 3 окт 2020 01:35 I had MLE because of bug in segment tree. In test 14: n = 0. |
| 1607. Такси. Ошибка на шестом тесте. Помогите ! | Navalnnny | 1607. Такси | 2 окт 2020 16:52 | 2 |
#include <iostream> using namespace std; int main() { long long a, b, c, d; int r = 0, g; cin >> a >> b; cin >> c >> d; g = (a + b * (c - a + d) / (b + d)) - ((a + b * (c - a + d) / (b + d)) % b); cout << g << endl; return 0; } Edited by author 02.10.2020 16:52 |
| test 4 fails | anupam | 1014. Произведение цифр | 1 окт 2020 08:04 | 7 |
i dont know why my code is failing test 4.can any body give me a series of test cases where this kind of program may fail. please help try it ACM.Tolstobrov_Anatoliy[Ivanovo SPU] 7 фев 2006 01:18 but i think if n<10 then least possible number will be n. your solution makes it 2 digit. The task is to find a minimal POSITIVE number, so 0 doesn't work. |
| (C++ VS Go) What are the tests #2 and #6? | grinrag | 1178. Дороги Акбардина | 29 сен 2020 01:02 | 2 |
I am learning Golang and rewriting my solutions from C++ to Golang, changes should no affect the result, but it started failing either on test #2 or test #6. Could you, please, provide me those tests to understand what is the problem? Thanks! Edited by author 29.09.2020 01:07 Ok, looks like in my case the format of input data in tests #2 and #6 is differ from the one in the example. Accepted Go code is: package main import ( "fmt" "sort" ) type city struct { n, x, y int } func main() { var n int fmt.Scan(&n) m := make([]city, n) for i := 0; i < n; i++ { m[i].n = i + 1 fmt.Scan(&m[i].x, &m[i].y) } sort.Slice(m, func(i, j int) bool { if m[i].x < m[j].x { return true } return false }) for i := 0; i < n; i += 2 { fmt.Println(m[i].n, m[i+1].n) } } time: 0.14 memory: 2 044 КB Edited by author 29.09.2020 01:10 |
| If you have WA 76 | Aleksandr Derevyagin | 1643. Атака Тёмной крепости | 28 сен 2020 21:56 | 1 |
Try this test 4 4 !### ABAA AABA *##$ The answer is 2 |