| Show all threads Hide all threads Show all messages Hide all messages |
| 1104 Time Limit Python 3 | SergeyGlazkov | 1104. Don’t Ask Woman about Her Age | 14 Oct 2019 07:29 | 1 |
1104 Task Help me please, I cant understand how can i do my calculations faster? I think that problem with slow input, but how else can i write it? p.s. using stdin, stdout get Time Limit as well maximal = 0 max_digit = -1 arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', \ 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', \ 'U', 'V', 'W', 'X', 'Y', 'Z'] for s in input(): number = arr.index(s) if max_digit < number: max_digit = number maximal += number if max_digit == 0: print(2) else: answer = '' for k in range(max_digit, 37): if not maximal % k: answer = k + 1 break if answer == '': print('No solution.') else: print(answer) Edited by author 14.10.2019 07:30 Edited by author 14.10.2019 07:41 |
| Завалено на 2 тесте! Язык питон 3 | Gosha | 1263. Elections | 13 Oct 2019 21:11 | 3 |
m = [] g = [] d, b = map(int, input().split(' ')) for i in range(1, b+1): n = int(input()) m.append(n) for i in range(1, d+1): g.append(i) for i in range(d): f = 0 for y in range(b): if m[y] == g[i]: f += 1/b*100 f = round(f, 2) a = str(f) if len(a) == 4: print(a+'0%') else: print(a+'%') при 100% проголосовавших выводится 100.0%. Edited by author 30.12.2018 18:16 Попробуй вариант где ответ - 100% |
| What is Test#15? | coder | 1495. One-two, One-two 2 | 13 Oct 2019 20:26 | 2 |
I had WA on the 15 test. I saved my answer in a string and i found what i was searching for minimum answer in wrong way, right code for taking minimum from 2 numbers, what are written in strings looks like : if (mn.size() > an.size()) mn = an; if(mn.size()==an.size()) if (mn > an) mn = an; |
| C, How to understand it? | Rodrigo Munoz | 1910. Titan Ruins: Hidden Entrance | 10 Oct 2019 12:51 | 1 |
this is a succsesful answer in C, but I want to understand it. Who can help me? #include <stdio.h> #include <stdlib.h> int main() { int n, x=1, FM; int arr[1000]; scanf("%d", &n); if(n<=1000 && n>=3) { for(int i=0; i<n; i++) { scanf("%d", &arr[i]); } FM=arr[0]+arr[1]+arr[2]; for(int i=1; i<n-2; i++) { if(arr[i]+arr[i+1]+arr[i+2]>FM) { FM=arr[i]+arr[i+1]+arr[i+2]; x=i+1; } } } printf("%d %d", FM, x+1); return 0; } Edited by author 10.10.2019 12:53 |
| WA 2 | DejaVu | 1131. Copying | 5 Oct 2019 23:01 | 1 |
WA 2 DejaVu 5 Oct 2019 23:01 #include <iostream> using namespace std; int main() { long int n, k; cin >> n >> k; long int a = 1; long int h = 0; if(n == 1){ cout << 0; } else if(n == 2){ cout << 1; } else{ while(n != 0){ if(a > k && a < n){ a = k; n -= a; h++; } else if(a > n){ n = 0; h++; } else{ n -= a; a *= 2; if(a > k){ a = k; } h++; } } cout << h; } } |
| WA#11 | Rodion | 2000. Grand Theft Array V | 5 Oct 2019 20:00 | 1 |
WA#11 Rodion 5 Oct 2019 20:00 Getting WA#11, give some tests pls |
| WA14, Time limit exceeded | mmmDanon | 1484. Film Rating | 4 Oct 2019 18:48 | 2 |
Please tell me what could be the problem... WA14, Time limit exceeded, Time work 1.014 Visual C#: if (x!=10.0){ sum=ToInt32((x+0.05)*n); while (sum/n>=x+0.049999999999) sum--; } else { sum=x*n; } while (((ans+sum)/(ans+n))>=y+0.0499999999999 ) ans++; у меня та же ошибка, С# просто медленно работает. Это же решение на ++ заходит |
| Помогите найти ошибку | Grigoriy Vorornin | 1484. Film Rating | 4 Oct 2019 13:13 | 1 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Globalization; namespace _1484Kino { class Program { static void Main(string[] args) { var userInput = Console.ReadLine().Split(); var x = double.Parse(userInput[0],CultureInfo.InvariantCulture); var y = double.Parse(userInput[1], CultureInfo.InvariantCulture); var n = int.Parse(userInput[2], CultureInfo.InvariantCulture); int count = 0; if (y > 0.9 && x<=10.0) { while (Math.Round(x, 1 )> 1) { x = ((x * n + 1) / (n + 1)); n += 1; count++; } Console.WriteLine(count); } else Console.WriteLine("Impossible"); } } } |
| [python] what I did wrong? | emfierro | 1001. Reverse Root | 4 Oct 2019 02:09 | 1 |
a=input().split('\n') j=[] for x in a: for xx in x.split(" ") : if(len(xx)>0): j.append( float(xx)**0.5) for i in range(len(j)-1,-1,-1): print(format(j[i],'.4f'))
|
| NO WAY ON PYTHON, TRY TO REWRITE ON OTHER LANG(time limit) | Ilya Lubashov | 1330. Intervals | 4 Oct 2019 02:07 | 1 |
Time limit test 20 failed on python. Rewrited on C# - everything OK. Edited by author 04.10.2019 02:08 Edited by author 04.10.2019 02:08 |
| help to how to end reading input in java | karthik reddy | 1001. Reverse Root | 3 Oct 2019 10:19 | 1 |
I tried to solve this problem in java since we have to accept as many number of lines given in input I wrote a while loop as follows while (in.hasNextLine()) // in is scanner object { // read input and do stuff } but this loop seems to run forever how do I stop the loop from running. |
| Is it broken for Python3? | Kirill Glebov | 1100. Final Standings | 3 Oct 2019 03:03 | 4 |
Several highly optimized solutions were TLE in Python3.6, though on local run in Linux it shows half of a time on your server. Is there some mistake? It is definitely broken, because same code works in Python 2 It is not broken. I managed to solve it with Python 3.6 There is one more way to solve it in Python 3 without sorting |
| runtime error (access violation) visual c++ | beslana | 1880. Psych Up's Eigenvalues | 2 Oct 2019 17:44 | 2 |
#include <iostream> #include <stack> using namespace std; int main() { unsigned short n1, n2, n3; int a, n=0; stack<int> group1; cin >> n1; for (int i = 0; i <n1; i++) { scanf_s("%d", &a); group1.push(a); } stack<int> group2; cin >> n2; for (int i = 0; i < n2; i++) { scanf_s("%d", &a); group2.push(a); } stack<int> group3; cin >> n3; for (int i = 0; i < n3; i++) { scanf_s("%d", &a); group3.push(a); } while (!group1.empty()) { if (group1.top() == group2.top()) { if (group1.top() == group3.top()) { n++; group1.pop(); group2.pop(); group3.pop(); if ((group1.empty()) || group2.empty() || group3.empty()) break; } else if (group1.top() > group3.top()) { group1.pop(); group2.pop(); if (group1.empty() || group2.empty()) break; } else group3.pop(); } if (group1.top() > group2.top())group1.pop(); if (group1.empty()) break; if (group1.top() < group2.top())group2.pop(); if (group2.empty()) break; } cout << n;
} what's wrong? after else group3.pop(); if (group3.empty()) break; accapte |
| Explanation of the worst case and the idea for solution. | grinrag | 1777. Anindilyakwa | 1 Oct 2019 13:54 | 1 |
We have got 3 distinct number, A < B < C. Let's imagine that the minimum difference Z = (C - B) goes between numbers A and B, closer to B, so new sequence will be A < Z < B < C. And the next minimum difference Y = (B - Z), goes between A and Z, closer to Z, A < Y < Z < B < C and so on. You see Y + Z = B, Z + B = C, the next number in the sequence (in order from left to right) is equal to the sum of current and previous members (looks like Fibonacci numbers). Now try to find the sequence with described property. Look at the example: 1 4 6 10 16 26 ... We can continue this sequence until the last two members will be 519390993822245170 and 840392281454979346. Their sum is more than 10^18. It takes only 83 iterations to build this sequence. The test case would be: 1 519390993822245170 840392281454979346 So, in the worst case, the number of iteration N < 100. The naive algorithm, when we just put the minimum diff to the array and sort it again will work. The time complexity will be O(N^2 log N). Edited by author 01.10.2019 14:24 |
| WA#6 test | trc-pskov | 2103. Corporate Mail | 1 Oct 2019 03:19 | 1 |
|
| WA#4 test | trc-pskov | 2103. Corporate Mail | 1 Oct 2019 02:28 | 1 |
helped for me 3 17 answer 1 3 3 18 17 |
| WA 7 | FeDoS (ONPU) | 1788. On the Benefits of Umbrellas | 30 Sep 2019 20:06 | 2 |
WA 7 FeDoS (ONPU) 13 Nov 2011 18:37 I can't find mistake, and have WA on test 7. Someone can give some cases? Edited by author 13.11.2011 18:38 Re: WA 7 egardoz[Yaroslavl SU]🔥☭ 30 Sep 2019 20:06 try 5 4 1 2 3 4 5 1 2 3 4 asn = 1 |
| THIS IS RUSSIA | brightsun | 1457. Heating Main | 30 Sep 2019 14:42 | 1 |
|
| Simpliest algorythm | Ilya Lubashov | 1139. City Blocks | 30 Sep 2019 07:23 | 1 |
//pseudo code divider = first_input-1; dividend = second_input-1; result: divider + dividend - FindCrossesOnTheWay(dividend,divider) *FindCrossesOnTheWay if(divider < dividend) swap() for(i=1;i<=divider;i++) if((dividend * i) % divider == 0) crosses++ |
| WA9 | Happyfeet | 1641. Duties | 28 Sep 2019 16:11 | 2 |
WA9 Happyfeet 11 Apr 2011 10:49 I've implemented this problem two different ways and I have WA9 on both of them. I'm possibly interpreting the problem wrong, but I've read the problem over and over again and I cannot come up with an alternative interpretation. Can someone please shine some light? Re: WA9 nikita20031405 28 Sep 2019 16:11 Если у кого ещё такая проблема есть, то это,как вариант, связано с нечетным n (последний человек ни разу не дежурит) |