| Show all threads Hide all threads Show all messages Hide all messages |
| WA #48 What it can be? | BinaryMind [RAU] | 1875. Angry Birds | 30 Apr 2015 22:30 | 1 |
I passed it, there was an defect in my algo :-) Edited by author 30.04.2015 23:51 |
| there is a solution with almost O(n) | maxi | 1146. Maximum Sum | 29 Apr 2015 20:50 | 2 |
#include <iostream> using namespace std; int n,A[1002],i,maxi,S[1002],st,dr,rez; int main() { cin>>n; for(i=1;i<=n;i++) cin>>A[i]; S[1]=A[1]; for(i=1;i<=n;i++) if(S[i-1]<=0) S[i]=A[i]; else S[i]=A[i]+S[i-1]; rez=-1000000; for(i=1;i<=n;i++) if(S[i]>rez) rez=S[i]; cout<<rez; return 0; } it's just a joke, isn't it? |
| WA7 in C# | ₰ҟᾷ®ßὂνṑγ (ONPU) | 1067. Disk Tree | 28 Apr 2015 22:35 | 4 |
You have to use StringComparer with parameter StringComparison.Ordinal to pass WA7 in CSharp. I've got AC in this way. |
| WA8? | Илья | 1280. Topological Sorting | 28 Apr 2015 16:16 | 1 |
WA8? Илья 28 Apr 2015 16:16 I dont understand why i get WA # 8 |
| How i can enter input. | Valery | 1006. Square Frames | 28 Apr 2015 07:05 | 7 |
please help me. I write program,but I can not test it, because I dont know how to enter a test. for i := 1 to n do readln(s[i]); use standart windows notepad when you press CTRL you can can use numpad to enter ASCII Codes of symbols open notepad: press ALT press 2 on numpad (digit keyboard on rigth side of keyboard) press 1 press 8 release ALT and you see Edited by author 15.09.2007 00:29 This is the sample input:(just copy it and look it in DOS) .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ...........谀哪哪?............................... ...........?....?............................... ....谀哪哪某.....?.........谀?.................. ....?.....?....?.........??.................. ....?.....?....?.........滥?.................. ....?.....?...诔哪哪?............谀?.......... ....?.....滥哪哪?...?............??.......... ....?.....?...?....?............滥?.......... ....?.....?...?....?........谀目.............. ....滥哪哪馁....?....?........?.?............. ................?....?........?.?............. ................滥哪哪?........滥馁.............. .................................................. .................................................. Edited by author 08.12.2007 17:30 Edited by author 08.12.2007 17:30 by the way you can use font "lucida console" or "terminal" I use #ifndef ONLINE_JUDGE in C and read the input in the same format as the output should look like, then draw the squares with C code in my program - makes testing much easier. Set you console encoding 1252 before input(c++ : system("chcp 1252");) Copy past below. Do not change encoding of browser (it should be UTF-8), other way it convert to 2 byte sequence. You can try to copy this to standard windows notepad. If using Notepad++, set encoding to UTF8 before paste. Should work. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ...........ÚÄÄÄÄÄ¿................................ ...........³.....³................................ ....ÚÄÄÄÄÄij.....³..........ÚÄ¿................... ....³......³.....³..........³.³................... ....³......³.....³..........ÀÄÙ................... ....³......³....Ú³ÄÄÄÄ¿.............ÚÄ¿........... ....³......ÀÄÄÄÄÄÙ....³.............³.³........... ....³......³....³.....³.............ÀÄÙ........... ....³......³....³.....³.........ÚÄÄ¿.............. ....ÀÄÄÄÄÄÄÙ....³.....³.........³..³.............. ................³.....³.........³..³.............. ................ÀÄÄÄÄÄÙ.........ÀÄÄÙ.............. .................................................. .................................................. Additional input: .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ...........ÚÄÄÄÄÄ¿................................ ...........³.....³................................ ....ÚÄÄÄÄÄij.....³......ÚÄ¿ÄÚÄ¿................... ....³......³.....³......³.³.³.³................... ....³......³.....³......ÀÄÙÄÀÄÙ................... ....³......³....Ú³ÄÄÄÄ¿.............ÚÄ¿........... ....³......ÀÄÄÄÄÄÙ....³.............³.³........... ....³......³....³.....³.............ÀÄÙ........... ....³......³....³.....³.........ÚÄÄ¿.............. ....ÀÄÄÄÄÄÄÙ....³.....³.........³..³.............. ................³.....³.........³..³.............. ................ÀÄÄÄÄÄÙ.........ÀÄÄÙ.............. .................................................. .................................................. Edited by author 28.04.2015 07:40 |
| Tip | Mihail | 1488. ACM Poker | 28 Apr 2015 01:19 | 1 |
Tip Mihail 28 Apr 2015 01:19 Be careful to check if the two cards in Dima's sleeve are the same! |
| C# programming language is supported now (+) | Vladimir Yakovlev (USU) | | 27 Apr 2015 21:04 | 8 |
The compiler is Microsoft ® Visual C# 2005 Compiler version 8.00.50727.42 (.NET Framework 2.0). The most of problems can be solved using C#, except for those that can't be solved with Java (1220, 1275, 1306). Edited by author 31.12.2006 01:31 using System; public class Sum { public static void Main() { string[] tokens = Console.ReadLine().Split(' '); Console.WriteLine(int.Parse(tokens[0]) + int.Parse(tokens[1])); } } If you need to read or write double in your program, do not forget set culture to InvariantCulture: Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; In some problems numbers are not necessarily separated with single space. Use Console.ReadLine().Split(new char[] {' ', '\t'}, StringSplitOptions.RemoveEmptyEntries) instread of Console.ReadLine().Trim().Split(' ') C# compiler has been updated to Microsoft Visual C# 2008 version 3.5.30729.1 (.NET Framework 3.5) The default decimal separator is now set to “.” All C# submissions to problems with floating-point numbers in input or output were rejudged. The verticts of about 800 submissions of 100 authors were changed. I have try to make some optimisation of input-output, but native read of stream does not bring some significant effect, and try of use Win32 api functions faults with runtime error on test 1 of task 1000. Where is the way to looking for? |
| error answer at test 10 -- how to find out what is wrong? | organmusic | 1842. Local Roots | 26 Apr 2015 17:56 | 1 |
All of my home-made tests have been passed succesfully but what is the test 10 which gives an error? How to get the test and what result should be for it? Edited by author 26.04.2015 18:07 |
| Test 1 | lex_t | 1106. Two Teams | 26 Apr 2015 15:08 | 1 |
Test 1 lex_t 26 Apr 2015 15:08 Hi, I have a solution which seems correct. For the first test it gives me the following answer: 4 1 4 5 6 I consider, it fits to the problem statement. Could anyone clarify, what is going wrong? My algorithm is based on BFS and I always mark start vertex in a connected component as a first team vertex. |
| wrong!!! | _harun | 1068. Sum | 25 Apr 2015 15:46 | 1 |
int main() { // ios_base::sync_with_stdio(false); int n,sum; while(cin>>n) { sum=0; if(n<0) for(int i=1; i>=n; i--) sum+=i; else sum=(n*(n+1))/2; cout<<sum<<endl; } return 0; } |
| If you have WA14 | [RISE] Levon Oganesyan [RAU] | 1891. Language Ocean | 25 Apr 2015 03:34 | 1 |
3 a() : int a(int) : real a(real) : int 3 int x = a() auto y = a(x) auto z = a(y) WA14 program says Error on line 3: No such function But right answer is y : real z : int |
| What is 5 test | test | 1984. Dummy Guy | 24 Apr 2015 14:28 | 4 |
please write the 5 test. I got wrong answer It must be N=10; But i dont know answer for N=10 Epsilon... Precision... Who cares, huh? Edited by author 19.10.2013 21:33 Thanks Leonid I should learn to pay attention! |
| Can someone give me some detailed explanations about his solutions to this problem? | aclsh | 1791. Uncle Styopa and Buses | 23 Apr 2015 22:25 | 1 |
My email is 843539450@qq.com,Thank you very much~ |
| Can you give me some test | Nujarin | 1353. Milliard Vasya's Function | 23 Apr 2015 17:54 | 5 |
Cos My English is Bad I don't Understand this Problem PS. Thank you Here is tests 1 _ 10 2 _ 45 3 _ 165 5 _ 1287 6 _ 3003 11 -> 75501 15 -> 478731 20 -> 2714319 45 -> 40051495 Please provide some more tests who have passed the problem 30 - 22505751 40 - 45433800 50 - 25614639 |
| Problem 1471. Distance in the Tree has been rejudged | Vladimir Yakovlev (USU) | 1471. Distance in the Tree | 23 Apr 2015 11:43 | 2 |
- New tests added - Time limit is set to 1 sec (was 2 sec) 78 authors have lost AC after rejudge. Nice rejudge, I've got ML 1 with 200 KB memory usage |
| How to make it faster than O(n^2) | [NU GYM] I am get tester... | 1056. Centers of the Net | 23 Apr 2015 03:36 | 5 |
Wow! O(n^2) is worked. I got Ac by time 1.3. But how solve it faster? One possible solution is to find the most distant computer(let's call it x) from the first, and then start BFS from it. The path from the last added in the BFS and x is the longest tree chain. So the middle nodes are the wanted answer. (if the chain has odd number of nodes, the answer will be n/2, and if it's even they will be n/2 and n/2+1) Well, Blade, it seems it's a well known solution here in Bulgaria :) My soulotion is O(n^2) but TLE on test 9.Here is my soulution. #include <iostream> #include <algorithm> using namespace std; int n; int way[10001][2]; int ps_max(int start) //Obxod(poisk) v shirinu { int *label,i,p(0),k(1),*fifo,cur; label=new int [n]; fifo=new int [n]; for(i=0;i<n;i++) { label[i]=32767; } label[start]=0; int max=0; fifo[p]=start; while(p!=k) { cur=fifo[p]; p++; for(i=0;i<n-1;i++) { if ((way[i][0]==cur || way[i][1]==cur)) { if (way[i][0]==cur && label[way[i][1]]>label[cur]+1) { label[way[i][1]]=label[cur]+1; if (label[way[i][1]]>=max) { max=label[way[i][1]]; } fifo[k]=way[i][1]; k++; } else if (way[i][1]==cur && label[way[i][0]]>label[cur]+1) { label[way[i][0]]=label[cur]+1; if (label[way[i][0]]>=max) { max=label[way[i][0]]; } fifo[k]=way[i][0]; k++; } } } } return max; } int main() { int i,t,min(100000); cin>>n; int *center; center=new int [n]; for(i=1;i<n;i++) { cin>>t; t--; way[i-1][0]=t; way[i-1][1]=i; } for(i=0;i<n;i++) { center[i]=ps_max(i); if (center[i]<=min) { min=center[i]; } } for(i=0;i<n;i++) { if (center[i]==min) cout<<i+1<<" "; } return 0; } There is an easy O(n) solution. Lets call vertexes that has only one neighbour(another vertex connected by edge) "lonely". Remove all lonely vertexes. Afterwards remove all lonely vertexes. Afterwards remove all lonely vertexes. Basically what we are doing is trimming the longest route from both sides. In the end there will be left only 1 or two vertexes(if longest path contains even amount of vertexes). Last vertexes will be the middle ones. |
| test 1 | BATJARGAL | 1106. Two Teams | 22 Apr 2015 13:51 | 1 |
test 1 BATJARGAL 22 Apr 2015 13:51 |
| 1 | BATJARGAL | 1106. Two Teams | 22 Apr 2015 13:51 | 1 |
1 BATJARGAL 22 Apr 2015 13:51 |
| TLE at G++ and Clang, AC at VS | monyura [ONU 1 2/3] | 1846. GCD 2010 | 22 Apr 2015 13:11 | 2 |
The same code with Dyramid got TLE at G++ and Clang and AC with 0.38 at Studio. I think the difference is to big, anybody now what is the issue? Edited by author 07.01.2015 07:16 0.234 at VS++2010 only segment tree (and 42 mb of memory). TL 15-16 at G++. |
| WA#11 Can I have sample test please? | Jumabek Alikhanov | 1123. Salary | 22 Apr 2015 06:08 | 2 |
|