|
|
Common Board[code deleted] Edited by moderator 01.12.2019 21:49 Don't use new Integer(), use Integer.parseInt() instead Thank you. I solved my problem, but diffrent way. I used : in.readLine().trim() instead of in.readLine() Edited by author 12.10.2008 21:20 Got AC. There were "Time Limit Exceeded" at tests 32, 56, 59, 60 before i made some complicated enhancements to my program. The monitor have shown smth around 0,9 second for some tests, so it was pretty close. My algo uses O(N*N) memory and O(N*Ln(N)) or O(N*N) operations (depends on input string; there are too slightly different ways of algorithm). I suppose there should be better solution. Any hints about that? Edited by author 12.10.2008 05:22 how did you do in O(N*Ln(N)) or O(N*N) operations ? I got AC, but my solution use 0.5+s, it's too slowly. I use O(N*N) find all Palindromes, and use greedy, memorize search oh, O(N*N) dynamic programing will get 0.1s Cool. At first, I wrote O(N^3). It was too slow. I wrote hash cutoff it so it was close to O(N^2), though, worst-case still O(N^3), got AC. Today I realize there is O(N^2) solution and read mention of O(N*log(N)). Is O(N*log(N)) bestcase? Is worstcase still O(N^2)? Edited by author 12.10.2008 20:22 i dont know how to set the frist... this is my program i wanna start from 1 but it start from 2.. thks :-)... public class SelfNumbers { public static void main (String args[]) throws Exception { int i = 1; int sum=0,recu,result=0,i_first; while(result<10) { i_first = i; sum=0; do { recu = i%10; i= i/10; sum+=recu; } while(i!=0); result=sum+i_first; if(result<=10) System.out.println(result ); i=result; } } } Hi, Just as a Recommendation for Java programmers Using BigInteger this problem is the same as 1009, well' u Just will have to find a way to run faster so you dont get TL, but BigInteger works fine! ;) WA test 5 why?? test PLEASE awasitacatisaw MY PROGRAM SHOW 2 a wasitacatisaw IS CORRECT??? try this: abbaa my program show 2 abba a is correct??? yes! why I dont now anderstand tiyi is very nandong Италия является слишком сложной для понимания название! abaaaa My program show 3 a b aaaa the correct out put is 2 aba aaa tanks As i can see from my compilation error ( http://acm.timus.ru/ce.aspx?id=2270863 ), there is no System.Collections.Generic.HashSet in your .NET framework, so your version should be older than 3.5 (or you have disabled the HashSet). Can you please say what exactly is supported and what is not; or which version of C#/.NET framework do you have? Also, it would be great to include an example of minimal working code in the FAQ. For example, solution of problem #1000: -- using System; namespace Task1000a { class Program { static void Main(string[] args) { String[] numbers = Console.ReadLine().Split(); Console.WriteLine((int.Parse(numbers[0]) + int.Parse(numbers[1])).ToString()); } } } -- Thanks Edited by author 11.10.2008 20:13As far as i can see: No Action<T1, T2, T3> supported (however, Action<T1> works); No lambda-syntax like Action<T> = T arg => { /*do something*/ } supported; however, Action<T> = delegate(T arg) { /*do something*/ } works. .NET 2.0 is supported now. We will move to .NET 3.5 in the near future. I cant undrestand how to count rectangles? pleaze explain it. Let me describe 2nd example of the task. 5 1 2 2 1 3 1 --- We will got this: [ ] [X] [X] [ ] [ ] There is 2 bars 'cause 1 square as well is bar. And it should be counted if it not contents into others longer bars. For example: ---------- 3 4 4 1 2 2 1 3 2 3 3 ----------- [ ][X][ ][ ] [X][ ][ ][ ] [ ][X][X][ ] The right answer will be horizontal: 1+1 = 2 vertical : 1+1 = 2 single blocks: 1+1 = 2 Answer is 6. How to build program? Dont allocate all matrix into memory as i did :))) Sorry for this idiotizm :( So u need to find out the optimal way. The program can be runed and exited with success with 300Kb of mem. I know this way, so i try to put the code here as fast as possible. The problem statement is very ambigous and tricky. Don't like such problems... Program is very easy, but undestanding what is requested by the authors- isn't. Thanks to Nikolai Besschetnov. Your sample saves me. Right math idea was having TLE for using set and vector after set. The same idea has AC 0.125 with malloc function for dynamic arrays. First , I used map < pair< int , int > , int > for finding lines of length 1 , but gave TLE too, then I did it in O(k) and got AC :) Edited by author 12.10.2008 03:27 abzzbbbzza ans: 4 a b zzbbbzz a and what will be for this one: abcbabcb 2 abcba bcb or 2 a bcbabcb is both correct???? pls explain it me Its easy. First line shows the total time taken by each team. Second line shows the number of failed test runs. If it passes first time, its 0 otherwise it shows the number of failed runs. Each failed run costs 20 min extra time. You should find if second team would win if they had no failed runs. Naskol'ko ya mogu ponyat', dlya vychislenya kachestva neobhodimo znat' A i B. No... Oni tam vrode ne dany... No comments. Please, use English As I can understand, for counting quantity we need A and B ... But they ain't given here! Сам-то почитай что гугл выдаёт ммм... благодарю за ответы разобрались сами.. :D For it is a convex polygon the best path won't self-cross, so a vertex Pi can only be connected to Pi-1 or Pi+1. Good Luck! Edited by author 11.08.2006 16:27 Sorry, what I meant was Pi must be connected to Pi-1 or Pi+1 or both of them. Then why do you call it DP and O(N^2)? It'll be just O(N) - find shortest side and send the loop around ploygon excluding that side. Edited by author 12.08.2008 16:38 test 11 PLEASE Edited by author 11.10.2008 15:36 test 11: 1) ddfffd 2) dfffdd Билеты на самолет продают до момента вылета самолета фактического, или до момента вылета самолета по расписанию? No comments if "NO COMMENTS" why you write this? information - Zero Забейте на билеты. нету их. Это из второго теста заметить можно =). Edited by author 11.10.2008 23:11 |
|
|