| Show all threads Hide all threads Show all messages Hide all messages |
| Your Mistake (Hint, no solution) | Euler | 2035. Another Dress Rehearsal | 27 Jun 2021 20:09 | 1 |
Maybe you forgot that the order of the numbers in the answer is important. |
| approach | Pavel | 1864. Get-Together at Den's | 24 Jun 2021 04:19 | 1 |
you can implement your simple fraction class and use it instead of floating point numbers |
| To admins (and python coders) | yyll | 1006. Square Frames | 23 Jun 2021 20:48 | 2 |
I don't know why, but in Python, code points of frame characters are: upper_left = 1066 upper_right = 1111 lower_left = 1040 lower_right = 1065 horizontal = 1044 vertical = 1110 That's really strange, because there are no common codecs encode those characters as such. Could Admin fix this or at lease give some explanations please? Also, don't put non-ascii characters in your source code, but use: c == chr(1066) or ord(c) == 1066 ord('┌') == 9484 list('┌'.encode('cp437')) == [218] list('┌'.encode('utf_16_le')) == [12, 37] # 12+37*256 == 9484 and Unicode code point is: U+250C == 9484 |
| There is issue with Kotlin / Java checker. | DENISKA(SSAU) | | 22 Jun 2021 22:47 | 2 |
Any submission on Kotlin or Java return 'Restricted function' error. Even solutions that previously could pass at least some tests. |
| Система проверки решений на Scala сломана | Anton Vorobyev | | 22 Jun 2021 22:45 | 2 |
Здравствуйте, решение из примеров для задачи "1000. A+B" object Main extends App { println(readLine().split(" ").map(_.toInt).sum) } выдает ошибку "Restricted function" |
| No subject | shawn | 1131. Copying | 22 Jun 2021 13:37 | 1 |
Edited by author 23.06.2021 07:43 Edited by author 23.06.2021 07:43 Edited by author 23.06.2021 07:43 |
| Test 10: RUB hasn't got 0.000 part. Рубль не имеет тысячной доли, так как минимальная часть - копейка - одна сотая. | Keworker | 1688. Team.GOV! | 21 Jun 2021 12:10 | 1 |
Remember: maximum accuracy can not be more than 10 in minus the secong degree. Запомните: максимальная точность числа не больше 10 в -2 степени. |
| What is difficulty of correct solution? | Zergatul | 2118. Cipher Message 4 | 20 Jun 2021 23:24 | 2 |
I have O(len(s) * k^2), and it is definitely too slow (TL#26). BTW, and here is some tests (don't want to create separate topic): 3 CC 00 1 01 ***** ans=-1 3 BAB 10 111 0 ***** ans=7 3 BA 00 01 1 ***** ans=3 3 CA 001 000 01 ***** ans=5 By applying suffix automaton, O(len(s) + k^2) complexity is received. |
| If you get WA #3 | Deepesson | 1177. Like Comparisons | 20 Jun 2021 15:50 | 2 |
Input: 3 '╣' like '[╣-I]' '╣' like '╣' '╣' like '_' Output: YES YES YES My AC solution gives NO to the first one; there should be no tests where the start character in a range is greater than the end character. |
| If you have WA7. | Keworker | 1617. Flat Spots | 19 Jun 2021 22:30 | 1 |
24 12 12 12 12 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Right Answer is 6 |
| You can use this table for easy AC. | Keworker | 1197. Lonesome Knight | 19 Jun 2021 11:21 | 1 |
. - empty cage 1 - chess knight 2 - cells under attack 8 | . . . . . . . . 7 | . . . . . . . . 6 | . . 2 . 2 . . . 5 | . 2 . . . 2 . . 4 | . . . 1 . . . . 3 | . 2 . . . 2 . . 2 | . . 2 . 2 . . . 1 | . . . . . . . . ___________________ a b c d e f g h 1 2 3 4 5 6 7 8 |
| how to solve | Denis | 1614. National Project “Trams” | 17 Jun 2021 22:24 | 18 |
is it possible to solve this problem with "smart" backtracking algo using a lot of restrictions ? As I know YES. But there easy and beautiful math solution. give me a hint how to solve it without using backtracking algorithm thank you Please send it to me too. eros_89@yandex.ru About math solution.. I am trying to it by the following way: Assume a connection between stops A and B. Then connection from B to A exists too. Then, to satisfy the problem's conditions, we have to introduce (2*n-1)*n connections (ordered in such a way that each tram route has 2*n-1 connections). All the connections are distinct. Next, each tram stop has exactly 2*n-1 connections to other distinct stops. It is always odd integer, so every tram stop must appear exactly once at the beginning of single route, and next time it must appear (2*n-2)/2=n-1 times in the middle of other routes. It is true for all the routes. So first we should build the following answer matrix if we consider n = 3: 1 x x x x 4 2 x x x x 5 3 x x x x 6 Then I am trying to place other elements to the matrix according to some placement rules from the thoughts above, but I am still unable to come up with a good solution. Could someone point out, am I going correct in my math thoughts or such approach leads to naive backtracking solution? Thanks! Sorry I was so verbose :D No more math is needed. Now you can use backtracking. I resisted the idea of writing a backtracking algo, but decided to implement it with rule of placing elements leftmost and outermost as you suggested and got AC :) Thank you. PS. I wonder if it is possible to write a backtracking solution without any initial placements or not. 2 Chmel_Tolstiy: Could you please give me small hint about a math solution? master.wsd064 (no spam) gmail.com Edited by author 03.04.2008 18:27 your Idea is a 2/3 of all way. just try to find a regularity between this paths. I think it's easy. naxart[at]yandex[dot]ru it's my email. I've found simple maths solution, here is my solution for n=3 1 2 3 4 5 6 2 4 6 1 3 5 3 6 2 5 1 4 Edited by author 02.06.2008 05:28 Edited by author 02.06.2008 05:28 There is no need for _smart_ backtracking. I placed 1..n on the left side and n..2n on the right side. Then I launched recursion over all cells row-by-row, column-by-column, taking every edge (i;j) exactly once, and it's AC in 0.078 sec. For n=100 there occurs only 562 returns. So, it's almost greedy algo. The only problem was expanding that recursion into a loop 'cuz I had stack overflow with 200x100 calls. Edited by author 25.07.2008 17:31 Continue filling the matrix from both left and right. Keep each pair of opposite columns contain every tram stops. I want to know too. pkkj@tom.com Thanks. Only math solution acceptable because this is structure design problem. I spent a lot of time but was unable to find it. Solution easy to find in internet with key words "decomposing complete graph in hamilton paths" Use diameters and walk left-rigth- down with respect to them. Edited by author 14.08.2009 11:02 no subject Edited by author 14.08.2009 11:03 |
| Stack Overflow | Night | 1553. Caves and Tunnels | 17 Jun 2021 20:27 | 3 |
Please I got Crash(Stack Overflow), I implemented my first heavy-light descomposition and tried this problem, but I got this. I got AC, I had to convert the DFS to BFS, to evade the StackOverflow. Edited by author 02.11.2011 04:45 Edited by author 02.11.2011 07:20 Edited by author 02.11.2011 08:20 {$m 100000000000000000000} You can use "G++ 9.2 x64" language to avoid it |
| Newton | yyll | 1475. Ryaba Hen | 17 Jun 2021 14:46 | 1 |
Sir Isaac Newton is important to this problem. In TWO different ways. |
| WA 28 ??? | Aleksander | 1346. Intervals of Monotonicity | 16 Jun 2021 21:18 | 4 |
Why WA 28?I don't understand. Here is my code: program gjkh; var a,b,ch,n,i,kol,sh,fir,sec,thi:longint; m:array[1..100001]of longint; flag:boolean; begin read(a);readln(b); n:=0; while not seekeof do begin read(ch); if (n=0)or(m[n]<>ch)then begin n:=n+1; m[n]:=ch; end; end; flag:=true; kol:=1; for i:=1 to n do begin if (i=1)then fir:=m[i] else begin if (flag=true)then begin sec:=m[i]; flag:=false; end else begin thi:=m[i]; if ((thi-sec)*(sec-fir)>0)then begin fir:=sec;sec:=thi; end else begin fir:=thi; kol:=kol+1; flag:=true; end; end; end; end; writeln(kol); end. 1 5 -100000 500000 -70000 800000 -80000 answ: 3 Edited by author 01.02.2010 18:44 Input numbers must not exceed 100000 by absolute value. why is 3, because there are 4 intervals? |
| WA#4 | Shohruh | 1927. Herbs and Magic | 16 Jun 2021 15:08 | 1 |
WA#4 Shohruh 16 Jun 2021 15:08 Edited by author 16.06.2021 15:21 Edited by author 16.06.2021 15:22 |
| what does that mean? " which are the number of the immediate superior" | Giorgi Pataraia [Tbilisi SU] | 1890. Money out of Thin Air | 15 Jun 2021 23:01 | 2 |
It means, each employee (except the director) has only one immediate superior. If employee A is superior to employee B, and employee C is superior to employee A, then C->A->B. Both C and A are superior to B, but only A is B's immediate superior. |
| weak tests | Vit Demidenko | 1099. Work Scheduling | 15 Jun 2021 21:00 | 1 |
|
| Getting MLE for this:|| | Reza Gharaghani | 1306. Sequence Median | 15 Jun 2021 13:14 | 1 |
#include<algorithm> #include<cstdio> using namespace std; #define MAX_N 250000 int n, i, t1, t2; int *heap; int main(){ scanf("%d", &n); heap = new int[n/2+2]; for(i = 0; i < n/2+1; ++i){ scanf("%d", heap+i); push_heap(heap, heap+i+1); }
for(i = 0; i < n/2-(n+1)%2; ++i){ scanf("%d", heap+n/2+1); push_heap(heap, heap+n/2+2); pop_heap(heap, heap+n/2+2); } if(n%2){ printf("%d.0\n", heap[0]); }else{ t1 = heap[0]; pop_heap(heap, heap+n/2+1); t2 = heap[0]; if((t1+t2)%2){ printf("%d.5\n", t1/2+t2/2); }else{ printf("%d.0\n", t1/2+t2/2+t1%2); } } delete[] heap; return 0; } |
| #WA3 need test case | jim | 1788. On the Benefits of Umbrellas | 15 Jun 2021 03:30 | 2 |
#include <iostream> #include <algorithm> using namespace std; int main() { int i,j,k,l,ii; int m,n; int girls[101]; int boys[101]; int count = 0; int upsets = 0, girlUpsets = 0, boyUpsets = 0, currentUpsets = 0; int happyGirls = 0; int chooseGirl = 0, chooseBoy = 0; for (i = 0; i <= 100; i ++) { girls[i] = 0; boys[i] = 0; }
cin >> n >> m; //n girls m boys for (i = 1; i <= n; i ++) { cin >> girls[i]; } for (j = 1; j <= m; j ++) { cin >> boys[j]; } count = min (m, n); //计算无配对upset值 for (i = 1; i <= n; i ++) upsets += girls[i]; happyGirls = 0;
for (i = 1; i <= count; i ++)
{ for (j = 1; j <= n; j ++) for ( k = 1; k <= m; k ++) { girlUpsets = 0; boyUpsets = 0; //计算girl upset值 for (l = 1; l <= n; l ++) { if (l != j) { girlUpsets += girls[l]; } } //计算boy upset值 for (l = 1; l <= m; l ++) { if (l != k) boyUpsets += boys[l] * (happyGirls + 1); //cout << "werqe: " << boys[l] << '\t' << boyUpsets << endl; } currentUpsets = girlUpsets + boyUpsets; if (currentUpsets < upsets) { upsets = currentUpsets; chooseGirl = j; chooseBoy = k; } } if (chooseBoy != 0 && chooseGirl != 0) { happyGirls ++;
//删除第chooseGirl个girl for (ii = chooseGirl; ii <= n - 1; ii ++) girls[ii] = girls[ii + 1]; n --;
//删除第chooseBoy个boy for (ii = chooseBoy; ii <= m - 1; ii ++) boys[ii] = boys[ii + 1]; m --; } } cout << upsets << endl; return 0; } |