| Show all threads Hide all threads Show all messages Hide all messages |
| Test #12 Output Limit Exceeded | Cebotari Vladislav | 1074. Very Short Problem | 13 Dec 2016 14:59 | 1 |
Hey guys any hints here? All examples from forum works on my program but this one exceeds. I guess it's because more than 200 characters are written, but I cannot find any test case that will require less written characters but the output will have more length |
| Accepted for changing the reading | 4EJ | 1846. GCD 2010 | 11 Dec 2016 11:04 | 1 |
I use a sement tree, gave tle in test 17 and when I changed the scanf by the following "std :: ios :: sync_with_stdio (false)" I have acepted with time of 0.358 s |
| Regarding a result - The sequence of ships in each row should also be ordered in a certain way. | organmusic | 1394. Ships. Version 2 | 11 Dec 2016 07:20 | 1 |
Since there can be more than one acceptable solution, I think, it could give a more unambiguous result. |
| why "wa #11"? | lian lian | 1642. 1D Maze | 10 Dec 2016 18:06 | 5 |
who could give some testdata to me ? 3 3 9 10 11 result? Edited by author 05.11.2008 04:11 My program have WA#11, please help? I think that test is incorrect in previous post! I've got AC. Try test like: 1 -1 100 Result:201 1 1 1 -100 Result:1 201 @lian lian that test is wrong,because the problem says,that there exists answer in any ocassion,but in this test you don't have negative values,so you can't count the quantity of moves... Edited by author 09.07.2010 17:03 3 2003 Edited by author 10.12.2016 18:09 |
| где ошибка? | Nick | 1025. Democracy in Danger | 10 Dec 2016 03:24 | 3 |
using System; class Program { static void Main() { int t = int.Parse(Console.ReadLine()); string[] s = Console.ReadLine().Split(' '); Array.Sort(s); int r = 0; for (int i = 0; i < (t / 2)+1; i++) { r += ((int.Parse(s[i]) / 2) +1); } Console.WriteLine(r); } } Edited by author 16.06.2012 19:10 Edited by author 16.06.2012 19:11 You must input all the array first, and only then work with it Edited by author 10.12.2016 03:26 |
| Timing results | Megakrit | 1263. Elections | 9 Dec 2016 02:10 | 3 |
Hi, folks! Can anyone give me the source code in C# of this task (mine is already AC) when the timing is less than 0.1 sec? Or can anyone give me the key notes how it can be decreased in almost ten times? Thanks in advance! I presume your sol is O(NM), right? Think a bit. There is O(N+M) solution which definitely has time better than 0.1 sec. 1) Be sure that your algorithm is O(N+M) 2) When calculating percents you should not do: value * 100 / number inside cycle, it is better to calculate "100.0 / number" one time before cycle and then just perfom multiplying. 3) I used float for keeping values, not int. I think it saves time of casting from int to float. When I used 2 and 3 my time for c# decreased from 0.109 to 0.046. |
| WA in test #2 C++ | LasTAD | 1263. Elections | 9 Dec 2016 01:31 | 2 |
#include <iostream> using namespace std; int main() { int cand, ch; cin >> cand >> ch; int* Ch = new int[ch]; double* Cand = new double[cand]; for (int i = 0; i < cand; i++) { Cand[i] = 0; } for (int i = 0; i < ch; i++) cin >> Ch[i]; for (int i = 0; i < ch; i++) { Cand[Ch[i]-1] += 1; } for (int i = 0; i < cand; i++) { printf("%.2f%%\n", (Cand[i]/6.0)*100.0); } } +++++++++++ Why this isn't work? What is the hardcoded value "6" in your code? |
| What's wrong with it?I am getting WA. | Ram Prakash P | 1020. Rope | 8 Dec 2016 19:54 | 2 |
#include <iostream> #include <cmath> #include <iomanip> using namespace std; int main() { int i,j,N,p; std::cin>>N; float cd[N][2],R,dist = 0.0; std::cin>>R;
for(p = 0;p < N;p++) std::cin>>cd[p][0]>>cd[p][1];
i = 0; j = i + 1;
dist = (2 * std::acos(-1.0) * R); while(i < N) { dist += std::sqrt( ( (cd[j][0] - cd[i][0]) * (cd[j][0] - cd[i][0]) ) + ( (cd[j][1] - cd[i][1]) * (cd[j][1] - cd[i][1]) ) ); i++; j = (i + 1) % N; }
std::cout <<std::setprecision(2) << std::fixed <<dist; return 0; } |
| Correct answer? | szczepi | 2105. Alice and Bob are on Bikes | 8 Dec 2016 19:27 | 2 |
What answer should be for given test? 1 1 1 1 0 |
| Sample explanation | Foobar | 1781. Clean Code | 8 Dec 2016 15:29 | 4 |
Can anyone explain the sample: 3 0 0 0 1 1 0 1 1 0
1 1 3 I dont understand it. The resulting matrix is: 0 1 1 0 1 1 0 0 0 Thanks! I think the correct final matrix must have all 1(s) above or lie on the main diagonal. Any hint to solve this problem ? Edit: nvm, solved it, nice problem with simple algorithm :D Edited by author 12.10.2010 11:07 Edited by author 12.10.2010 11:07 This problem very similar with 1042- central heating Each move (i,j) make switching (and replacing) of some set of pairs of cells. Thus we have linear system over field {0,1) No, the solution is much simplier. You just need to investigate the properties such an operation has. Edited by author 08.12.2016 15:31 |
| Use 'Visual C++ 2013' instead of 'G++ 4.9 C++11' | 🎧 Vadim Barinov \Frez_Fstilus/'``' :) | 1198. Jobbery | 7 Dec 2016 21:29 | 1 |
Same solution: Visual C++ 2013: Accepted 0.686 8 120 КБ G++ 4.9 C++11: Time limit exceeded 21 1.513 3 924 КБ oh my code.. |
| I have some thought on this problem: | Shen Yang | 1399. Economical Director | 7 Dec 2016 14:25 | 1 |
first use dynamic programming to find the minimum value of distance from 0 and visit 1~m once then to 0, we can get a chain 0--i1-i2--...-im--0 then we consider to cut this chain, use dynameic programming dp[i] to record distance.we cut first i node of the chain.. dp[m] is the result.. I'll try this idea... |
| C++ ac,G++ TLE | Shen Yang | 1626. Interfering Segment | 7 Dec 2016 12:26 | 3 |
judgement is not stable,sometimes submit AC sometimes submit TLE... 800*800*400 random can AC |
| what is test number 2? | tantai1993 | 1086. Cryptography | 7 Dec 2016 10:04 | 2 |
can someone explain test number 2? |
| does anybody have java solution for this task? | Михаил Аршинов | 1732. Ministry of Truth | 7 Dec 2016 06:13 | 2 |
please post it (read chunk) here or give some piece of code, many sanx! java AC 0.171 dont use String.toCharArray btw WA7 (add line 2): 1. for (i=p; i<lena; i++) 2. if (a[i]==' ') out2.print(' '); else 3. out2.print('_'); ab ab abcabcabcd | a b bcd | a_ _b _______bcd | so WA 7 controverses with "The words in both utterances are separated with exactly one space; there are no leading or trailing spaces in each line." Edited by author 07.12.2016 06:15 |
| На тестовых входных данных вроде всё ок. Но выдаёт Wrong Answer. Почему? | ivanbelousov | 1001. Reverse Root | 6 Dec 2016 18:12 | 2 |
#include <stdio.h> #include <math.h> int main( int argc, char ** argv ) { unsigned long number[256*1024]; int counter = 0; while( scanf("%lu",&number[counter]) != EOF ) { counter++; }
for( counter--; counter >= 0; counter-- ) printf("%.4f\n",sqrt(number[counter])); return 0; } |
| how to get ac in 0.031 sec? | Radi Muhammad Reza | 1742. Team building | 6 Dec 2016 15:06 | 4 |
i just found no of storngly connected components and got ac in 0.562 sec after eliminating stack overflow with pragma. how to make it so fast as 0.031 sec and so little memory? You don't have to find strongly connected components. You can just sort vertices topologically and here you will find an answer :) But for topological sorting, graph must be DAG(directed acyclic)? i just keep getting stack overflow,could you please tell me how to eliminate it? |
| If you have WA10 | gepardo | 2092. Bolero | 6 Dec 2016 10:22 | 1 |
Try this test: Input: 5 1 100 0 100 0 100 0 100 0 100 0 2 50 Output: 250 |
| WA 22 | Combatcook [YarSU] 🐸 | 1513. Lemon Tale | 4 Dec 2016 20:24 | 3 |
WA 22 Combatcook [YarSU] 🐸 4 Dec 2016 14:13 Hello! I have strange WA 22 and really don't understand why. Can anyone help to find the bug in my code. (corrected) Edited by author 04.12.2016 20:25 Re: WA 22 Jane Soboleva (SumNU) 4 Dec 2016 15:48 Your answer to 10000 10000 seems correct, except it misses the very first digit. Re: WA 22 Combatcook [YarSU] 🐸 4 Dec 2016 20:24 Thanks! Stupid mistake, as always, just increased size of long number. |
| WA Test #3 | TwoFace | 1787. Turn for MEGA | 4 Dec 2016 16:17 | 2 |
import java.util.*; import java.io.*; public class MEGA { public static void main(String arg[]) { int k,n,i,sum=0; Scanner scan=new Scanner(System.in); k=scan.nextInt(); n=scan.nextInt(); int[] a=new int[n]; for(i=0;i<n;) { if(scan.hasNextInt()) { a[i]=scan.nextInt(); i++; } } for(i=0;i<n;i++) { sum+=a[i]-k; } if(sum<0) { System.out.println("1"); } else { System.out.println(""+sum); } } } This very simple program is turning out to be a headache. What is Test #3? inside cycle you need to check that (sum + a[i] - k) >=0 Edited by author 04.12.2016 16:18 Edited by author 04.12.2016 16:18 |