| Show all threads Hide all threads Show all messages Hide all messages |
| Hi all,I have just accepted this problem ,my time is 1s,i know why,because my Prime(MST) algo is very slow ,who can give me Prime algo (c++). | Harhro94 [Hrayr Harutyunyan] | 1709. Penguin-Avia | 8 Jul 2011 23:17 | 2 |
|
| WA 6, can't find the problem | predrag | 1580. Dean's Debts | 8 Jul 2011 17:25 | 3 |
I get a Wrong answer on test case 6 on this problem. Would it be possible (and legal, of course) for me to see the test case and/or a similar case that demonstrates why my solution is incorrect so I can test it locally? I need a hint ( or test case ) aswell. I was looking for an TLE error but instead I got WA. This test helped me to resolve WA6: 4 4 1 2 2 2 3 2 3 4 2 4 2 2 Answer is: 1.00 1.00 1.00 1.00 |
| help me WA #7 | Uzbek boy | 1581. Teamwork | 8 Jul 2011 12:47 | 1 |
please, give me any test for WA #7 |
| HELP TO SOLVE THIS PROBLEM IN C++ PLEASE | BORIS (YSU) | 1493. One Step from Happiness | 7 Jul 2011 22:33 | 2 |
Edited by author 17.10.2010 20:13 you can use sprintf, and problem becomes easier |
| WA 14, please give test | Vasily Slesarev | 1828. Approximation by a Progression | 7 Jul 2011 21:35 | 2 |
Now AC. The problem was with precision. |
| Can anyone explain to me TEST #1 plz ? Tks | Nguyen Khac Tung | 1087. The Time to Take Stones | 7 Jul 2011 06:47 | 1 |
Can someone write the sequence of stone that lead to player 2 lose plz ? |
| Wa#3 | Harhro94 [Hrayr Harutyunyan] | 1804. The Machinegunners in a Playoff | 6 Jul 2011 22:38 | 4 |
Wa#3 Harhro94 [Hrayr Harutyunyan] 29 May 2011 00:00 Please answer,waht is the right answer for this text` The Machinegunners played away game, scored 0 goals, and conceded 0 goals. ? 0 30 Other tests 4 The Machinegunners played away game, scored 30 goals, and conceded 1 goals. The Machinegunners played away game, scored 30 goals, and conceded 30 goals. The Machinegunners played home game, scored 30 goals, and conceded 1 goals. The Machinegunners played home game, scored 30 goals, and conceded 30 goals. ans 0 1 0 30 0 1 1 30 Edited by author 08.06.2011 01:01 Edited by author 08.06.2011 01:01 Edited by author 14.07.2011 09:04 Re: Wa#3 Harhro94 [Hrayr Harutyunyan] 6 Jul 2011 22:38 |
| Wa9 need some selp or a test. | Harhro94 [Hrayr Harutyunyan] | 1208. Legendary Teams Contest | 6 Jul 2011 22:19 | 1 |
|
| почему невернЬІй ответ? | Andriy_Zhyvchyn | 1369. Cockroach Race | 6 Jul 2011 18:32 | 1 |
#include <iostream> #include <math.h> using namespace std; float tar[100000][2]; float slad[10000][2]; float ooo[100000][2]; int prov (float a[100000][2], int n) { int i=0; int j=0; for (i=0; i<n; i++) for (j=i+1; j<n; j++) if (a[i][0]==a[j][0] || a[i][1]==a[i][1]) return 0; return 1; } void obch (float x, float y, float tarr[100000][2], int mm, float oooo[100000][2]) { int ii=0; for (ii=0; ii<mm; ii++) { oooo[ii][0]=sqrt(((x-tarr[ii][0])*(x-tarr[ii][0]))+((y-tarr[ii][1])*(y-tarr[ii][1]))); oooo[ii][1]=ii+1; } }
float min_n (float oooo[100000][2], int mm) { float nomm=oooo[0][1]; float znn=oooo[0][0]; int ii=0; for (ii=0; ii<mm; ii++) { if (oooo[ii][0]<znn) { nomm=oooo[ii][1]; znn=oooo[ii][0]; } } return nomm; } int main () { int i=0; int m; int n; float min; cin>>m; for (i=0; i<m; i++) { cin>>tar[i][0]; cin>>tar[i][1]; } cin>>n; if(m<=n || m<=0) return 0; for (i=0; i<n; i++) { cin>>slad[i][0]; cin>>slad[i][1]; } if (!prov(tar,m) && !prov(slad,n)) return 0; for (i=0; i<n; i++) { obch (slad[i][0], slad[i][1], tar, m, ooo); min=min_n(ooo,m); for (float j=min-1; j<m; j++) if (ooo[(int)(min-1)][0]==ooo[(int)(j)][0]) cout<<ooo[(int)(j)][1]<<' '; cout<<endl; } system ("pause"); return 0; } |
| biparite matching | Лукьянчиков Владимир Игоревич | 1389. Roadworks | 6 Jul 2011 18:11 | 7 |
is it possible to find biparite matching for n or n logn? if we divide graph into 2 parts - maximal matching is the answer. But biparite matching founding time is NM(max-flow) so N*N(because it's tree). I got AC using bipartite matching :) I'm too - Hopcroft-Carp rulezz=) i use dynamic progrmaming and got AC in O(N), i think the best the algo too find maximum biprate matching ue O(nm), what's your algo????? sorry for y poor english. AFAIK, Fastest biparite matching algorithm - Hopcroft Carp, with complexity E*sqrt(V); V-num of vertices; E - num of edges; Given graph is a tree, so it's possible to color it into 2 colors, after that, take all black vertices as one part, white as other part and find max matching between them. I can't give strict evidence of this approach but it intuitively understandable - just draw sample output on the paper and everything will become clear=) You can see my code -> i shared my account here http://acm.timus.ru/forum/thread.aspx?id=25749&upd=634266195834002500 Just look my submission. this algo is very similar to Dinica algorithm, are they identical? ну, не знаю даже! Кун прошел за 0.9 |
| No subject | Михаил | 1021. Sacrament of the Sum | 6 Jul 2011 17:28 | 1 |
Edited by author 09.07.2011 10:54 |
| advice to those who use set instead of heap | Vyacheslav Kim | 1326. Bottle Taps | 6 Jul 2011 17:09 | 2 |
use priority_queue, it eats less memory Use array, it eats less memory =))) |
| Why WA? | Georgeek | 1617. Flat Spots | 6 Jul 2011 12:15 | 1 |
import java.util.Arrays; import java.util.Scanner; public class Example2 { private static int[] col; private static int count = 1; private static int superCount = 0; public static void main(String[] args) { try { Scanner scanner = new Scanner(System.in); int a = scanner.nextInt(); if (a>=0 && a<=150){ col = new int[a]; for (int i = 0; i < a; i++) { col[i]=scanner.nextInt(); if(col[i]<600 || col[i]>700){ //System.out.print("0"); throw new Exception(); } } Arrays.sort(col); for (int i = 1; i < col.length; i++) { if (col[i]==col[i-1]) { count ++; if (count==4) { superCount ++; count=1; } }else count=1; } System.out.print(superCount); }else if (a>=0){System.out.print("0");} } catch (Exception e) {} } } |
| why?【1001,pascal】 | Pan Yuchong | 1001. Reverse Root | 6 Jul 2011 12:04 | 2 |
program ural_1001; var t,n,i,j:longint; a:array [0..1000000] of real; begin while not eoln do begin inc(t); read(a[t]); a[t]:=sqrt(a[t]); end; for i:=t downto 1 do writeln(a[i]:0:4) end. eoln=end of line "...переводов строк..."=> you must using eof(end of file) Edited by author 06.07.2011 12:05 |
| test3 Crash (access violation) | error | 1837. Isenbaev's Number | 6 Jul 2011 10:25 | 1 |
|
| No subject | Aybek | 1590. Bacon’s Cipher | 6 Jul 2011 01:41 | 2 |
Edited by author 06.07.2011 10:45 Edited by author 06.07.2011 10:45 |
| Why Crash? | Georgeek | 1585. Penguins | 5 Jul 2011 14:40 | 1 |
import java.util.Scanner; public class Example { private static int n; private static String[] penguin; private static int[] myCount = {1, 1, 1}; public static void main(String[] args) { Scanner scanner = new Scanner(System.in); n = scanner.nextInt(); if(n>=1 && n<=1000){ scanner = new Scanner(System.in); penguin = new String[n]; for (int i = 0; i < n; i++) { penguin[i] = scanner.nextLine(); if (penguin[i].equals("Emperor Penguin")) { myCount[0]++; }else if (penguin[i].equals("Little Penguin")) { myCount[1]++; }else if (penguin[i].equals("Macaroni Penguin")) { myCount[2]++; } } if(myCount[0]>myCount[1]){ if(myCount[0]>myCount[2]){ System.out.println("Emperor Penguin"); }else{ System.out.println("Macaroni Penguin"); } }else if(myCount[1]>myCount[2]){ System.out.println("Little Penguin"); }else{ System.out.println("Macaroni Penguin"); }
} } } |
| TLE 21 NlogN, NsqrtN | Alias aka Alexander Prudaev | 1579. Coat Transportation | 5 Jul 2011 13:04 | 22 |
i have write NlogN algo - TLE 21 then i rewrite it in N*sqrt(N) - TLE 21 maybe something wrong with this test? Strange.... My solution which got AC in contest gets TLE 21 too. Besides my solution is O(n log k) Where k is number of "run" in the market. The correct solution is O(N). Try to find it. ln N is just 17 Less then 2 million iterations. O(n lg n) also should pass TLE. Why my O(n lg n) solution passed during contest? Edited by author 16.10.2007 03:39 maybe you are right and there is O(n) solution but my NlogN and NsqrtN should pass any test with n <= 100000 so i think this file is empty and i got TL when read as scanf("%d", &n); Edited by author 14.10.2007 11:29 when i use vector<vector<int>> it was TL but if use vector<myvector>> i got Ac 0.203 it is strange... At the contest I was a bit lucky to make a solution O(n*m) where m is the number of groups and it passed... My first solution was n*log(n ) but it was TL :( This problem can be solved using 1 array of integers and a few variables in O(n) time (one "for" loop, actually). Try to find it, it is more interesting than optimizing your obvious N*logN solutions. I understand you, there is an O(N) solution. but i cant see it can we talk about in ICQ (my icq is 410673122) I have an O(n) solution but it works about 0.5 sec... Why? Don't forget, that reading about 1MB of input also requires a lot of CPU time. Now so fast, but AC with O(NlgN). Just used myvector as inner container and some optimization on function calls. Really strange.. I have Accepted for my solution, complexity O(n * log(n)) written in Java without any optimization with time 1.5 sec. Mates! I finded O(N) solutions in my 16 years! So use your brain and find it too! P.S. 0.093 sec, but 2 592 КБ memory... Edited by author 22.10.2007 02:55 Maybe you mean solution using unintersectable sets? It's really fast and you don't have to use additional memory. My solution O(N) took 0.421 and 7 969 КБ because I used dinamic structures with pointers to next nodes. :) N*log(N) - 0.187 sec. Did not optimize anything, but stored amount for same-size coats. Brilliant problem! Solved in O(N) with 3 lines of creating chains and bit more lines for printing results. Fist tried to solve it as 1533 (Fat Hobbits), but it is much easier |
| What answer on this test? | r1d1 | 1606. Slalom | 5 Jul 2011 11:06 | 2 |
3 2 1 2 3 2 4 This sample correct? Edited by author 14.07.2010 13:02 yes, it is correct. for both of samples below answer is 1 (anyone of poles) 3 1 2 3 2 4 2 3 2 1 2 3 2 4 |
| WA on Test №103 | Molochiy Ivan[ Lviv NU ] | 1534. Football in Gondor | 5 Jul 2011 07:27 | 3 |
New test has been added and my program had WA on test 103. Can someone give me this test? I have your problem too. If You fined mistake, please, send to "mihran91@mail.ru". (Sorry for my English) Edited by author 04.11.2007 23:30 |