| Show all threads Hide all threads Show all messages Hide all messages |
| correct | 😜Obelix😜 | 1100. Final Standings | 10 Mar 2018 08:35 | 1 |
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; pair<int ,int > a[150000]; for(int i=0;i<n;i++) { cin >> a[i].first >> a[i].second; } for(int i=100;i>=0;--i) { for(int j=0;j<n;j++) { if(i==a[j].second) cout << a[j].first << " " << a[j].second << endl; } } } |
| What's wrong? | mb1te | 1506. Columns of Numbers | 9 Mar 2018 19:58 | 1 |
WA #2 a = input().split() s = input().split() n, k = int(a[0]), int(a[1]) out = ["" for x in range(n//k+1)] for i in range(k): if i != k - 1: for j in range(n//k+1): if len(s[0]) == 1: out[j] += " " + s[0] s.pop(0) elif len(s[0]) == 2: out[j] += " " + s[0] s.pop(0) else: out[j] += " " + s[0] s.pop(0) else: for j in range(n%k): if len(s[0]) == 1: out[j] += " " + s[0] s.pop(0) elif len(s[0]) == 2: out[j] += " " + s[0] s.pop(0) else: out[j] += " " + s[0] s.pop(0) for i in out: print(i) Edited by author 09.03.2018 19:59 |
| WA2. Need in tests | __Andrewy__ | 1890. Money out of Thin Air | 9 Mar 2018 12:32 | 1 |
|
| Any hints? Solved by interval trees? | Safe Bird | 1390. Shots at Walls | 8 Mar 2018 20:00 | 5 |
wall 0 1 1 0 shot 0 1 Infinity or 1? that will cause a precision error I think get Accepted using divide and conquer I think raytraycer based on kd-tree (SAH) with ropes is most suitable for this task. Time (just sequential number) can be saved in primitives and min of times in nodes to speedup calculations. |
| Precision? | chhung6 | 1766. Humpty Dumpty | 7 Mar 2018 22:43 | 18 |
It seems that the main problem is precision. If it is so, how could we compute the answer more accurately? e.g., set what Epsilon threshold for determining a value being 0 ? There are some methods to solve problem. 1. Gauss. It really has troubles with precision. 2. Method of iterations. It works good, but your implementation should be fast enough and do about 2^50 iterations :) Thanks for your reply. :) I used Gaussian Elimination. Seems it's very difficult to handle the precision... We tried both methods but failed... It seems that using iterations could lead to precision problem too..we calc something like mat[64][64],and do mat^(2^60),but it turns out that the value in mat overflows... Sorry for my poor english-_- Just add something like that after each multiplication. void normalize(double a[][64]) { for(int i = 0; i < 64; i++) { double sum = 0; for(int j = 0; j < 64; j++) sum += a[i][j]; for(int j = 0; j < 64; j++) a[i][j] /= sum; } } Thanks a lot, Nikita! This normailze function really helps!
My program needs only 2^26 iterations using it, and without this function i received WA #1 all the time. Edited by author 17.06.2010 14:28 I used Gauss. But with BigDecimal. Can you explain why iterations more precize than gauss? Why you think that it is necessary about 2^50 iterations? I think that there exists a good alternative to Gaussian elimination - QR - decomposition of the matrix. It's precision, I think, would be good enough because it doesn't change the condition number of the matrix. I tried to solve it as you said. TL #3 ... QR - decomposition is only a bit slower than Gaussian elimination, and it's also O(n^3) Could you expalin what is the QR-decomposition? Maybe, I didn't understand you very well. Thanks a lot! But I don't understand how could it be useful to avoid big precision troubles with Gauss algorithm. I don't understand too. :-[ These methods have less calculation errors than Gauss method. But there is modification of Gauss method which more precise than QR-decomposition methods. In this modification we choose main element from all remaining elements in matrix. You can read about methods for solving systems of linear algebraic equations in the book: А.А.Амосов "Вычислительные методы для инженеров". Of course, there are a lot of other sources. Just want to mention that I kept getting WA and after changing double to long double immediately got AC. Maybe it helps |
| case 4:Output limit exceeded. help! | jim | 1893. A380 | 7 Mar 2018 19:58 | 1 |
output limit exceeded! what's the case 4 like? 3Q |
| What's wrong......??? | Al Arafat Tanin | 2056. Scholarship | 7 Mar 2018 04:32 | 1 |
#include<stdio.h> int main() { int n , m , sum=0 ; double ava; scanf("%d",&n); int mark[11]; for(m=0;m<n;m++){ scanf("%d",&mark[m]); } for(m=0;m<n;m++){ sum=sum+mark[m]; } ava=(double)sum/n; if(ava<=3)printf("None\n"); else if (ava>=5)printf("Named\n"); else if(ava>=4.5)printf("High\n"); else printf("Common\n"); } |
| what is correct ans when WA #6 ....?? | Al Arafat Tanin | 2098. Lada Priora | 7 Mar 2018 02:45 | 1 |
|
| is there any non-print table approach?? | Shen Yang | 2061. OEIS A216264 | 6 Mar 2018 09:51 | 2 |
|
| wa 11 | Paata Julakidze[GTU] | 1106. Two Teams | 5 Mar 2018 20:06 | 1 |
wa 11 Paata Julakidze[GTU] 5 Mar 2018 20:06 My solution is crushed on 11 test. please help me... |
| WA#4 | Kolyanich | 1751. Improbability Theory | 5 Mar 2018 14:26 | 2 |
WA#4 Kolyanich 17 Apr 2011 22:07 be careful don't compute repeated floyd[i][j]=true only once |
| Time consumed by outputting large arrays to the console | Ilya | 1701. Ostap and Partners | 5 Mar 2018 03:51 | 1 |
Hello all. I am doing task #1701, but ,actually, my question is also related to other equal tasks: how can you not exceed the time limit when the task supposes large array as the answer? For instance, in mentioned task the time is limited to 2 seconds. In case when N == 50 000, if possible set of emplyee's salaries exists, you need write 50 000 strings to console. But, as i have found out by measurig, only outputting array to the console takes over 3-5 seconds. Test it using C# and C++ with array of int values set to "0". Edited by author 05.03.2018 09:04 |
| If you have WA5 | [ITMO] Semyon Stepanov | 1067. Disk Tree | 4 Mar 2018 23:08 | 1 |
If you use set<A*> or std::sort/std::stable_sort vector/array of pointers, your comparator won't work, because you need special comparator, like this struct APtrCmp { bool operator()(const A* lhs, const A* rhs) const { /* implement logic here */ } }; set<A*, APtrCmp> yourSet; Good luck! ;) |
| Why wrong (c) | vilikan | 1068. Sum | 3 Mar 2018 09:52 | 6 |
#include <stdio.h> #include <math.h> int plus(int number){ return number*(number+1)/2; } int minus(int number){ return (-(number*(number+1)/2))+number; } int main(){ int N; scanf("%d",&N); if(abs(N)>=1 && abs(N)<=10000){ if(N<0) printf("%d",minus(N)); else printf("%d",plus(N)); } } Why do you think, that 0 is prohibited input? What the reason to check input at all? "if(abs(N)>=1 && abs(N)<=10000)" is superfluous. The statement of the problem can't lie. Thanks you so much. I'm new to olympiad programming and I sometimes make silly mistakes thanks to pointing to them Edited by author 03.03.2018 09:54 Edited by author 03.03.2018 09:53 |
| same as 1075 | [MAI] ssor96 | 1285. Thread in a Hyperspace | 2 Mar 2018 18:00 | 1 |
this task is the same as 1075, but with a different number of dimensions(it doesn't really matter) |
| WA24 | Alexander | 1912. Titan Ruins: Passing through Walls | 2 Mar 2018 12:25 | 1 |
WA24 Alexander 2 Mar 2018 12:25 3 different solutions gets WA24. Is this test correct or I don't understand the statement? |
| C++17 | ASK | | 2 Mar 2018 01:06 | 4 |
C++17 ASK 28 Feb 2018 14:35 If we run GCC 7.1, we can as well use -std=gnu++17 Re: C++17 Anatoliy V Tomilov 28 Feb 2018 21:18 Re: C++17 Anatoliy V Tomilov 2 Mar 2018 01:06 I have no G++ 7.1 to check. But G++ 7.2 said you are correct. |
| Very Useful Advice | SergeyGlazkov | 1049. Brave Balloonists | 1 Mar 2018 20:46 | 1 |
Before sending your solution try this test on your pc and make sure that pc can calculate it faster than 10 hours :)) 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 1 |
| решение С# | Terekhin Grigory | 1787. Turn for MEGA | 1 Mar 2018 15:32 | 1 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace РџРѕРІРѕСЂРѕС‚ { class Program { static void Main(string[] args) { string[] mas = Console.ReadLine().Split(' '); int k = int.Parse(mas[0]); int n = int.Parse(mas[1]); int[] A = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(i => int.Parse(i)).ToArray(); int M = 0; for (int i = 0; i < n; i++) { M += A[i]; if (M - k >= 0) {M -= k;} else {M = 0;} } Console.WriteLine(M); } } } Надеюсь понятно всё. |
| The code on Python work correct whe same code on Ruby have wrong answer #3 | Valentin Gulyaev | 1785. Lost in Localization | 26 Feb 2018 00:33 | 3 |
Have solved this task in Python many years ago. How test my code on Python and have Accept This code on Ruby have WA on test №3 Stay tuned and inform us as quick as possible. |