| Show all threads Hide all threads Show all messages Hide all messages |
| I think my code is right but it is not getting accepted. | Tanay | 1493. One Step from Happiness | 23 Nov 2017 13:44 | 1 |
I think my code is right but it is not getting accepted. Can anyone help me figure out what is wrong ? The python code is as follows: n=input() sum1=0 sum2=0 for i in range(0,3): sum1=sum1+(int(n[i])) for i in range(3,6): sum2=sum2+(int(n[i])) if(1==(abs(sum1-sum2)) or 0==sum1-sum2): print("Yes") else: print("No") Pls help me solve the issue Edited by author 23.11.2017 13:45 |
| Test for 24 test | Kairom `Ekexity 💻 | 1888. Pilot Work Experience | 23 Nov 2017 11:34 | 1 |
10 10 4 2 2 3 3 1 1 5 5 6 6 7 2 8 8 9 9 10 10 6 answer is: 6 4 2 3 1 5 6 7 3 4 5 |
| can anyone help me to understand solution? | Anatoly Konenko | 1447. Portkey Network | 22 Nov 2017 22:21 | 2 |
I try to find alghoritm for this program, and can't find it. I read in other post next scheme w(x)=a-b*x is weight of every edge Z(x)=0 - solution. how understand w(x) ? Can I solve this problem without Z(x)=0 ? Я также хотел бы почитать про данную идею решения. На форуме есть ссылка на статью, но она на недоступном для меня английском языке. Насколько я понял с помощью Google переводчика, на форуме обсуждается следующее:каждому ребру присваивается вес w(x)=a-x*b, a-себестоимость, b-расстояние. Рассматривается целевая функция Z(x)=Sum(a,x,E)-x*Sum(b,x,E), где E-рёбра минимального остова с весовой ф-ей w(x), x-параметр, Sum(a,x,E) = Sum(a) в E, Sum(b,x,E) = Sum(b) в E (или Z(x)=Sum(w(x) в E)). Уверяется, что решение задачи 1447 достигается только в т.х : Z(x)=0. Док-во (моё): Сразу скажем, что ai,bi>0; 1)Необх.: пусть х - решение => Sum(a,E)/Sum(b,E)=x -> min => Sum(a,E)-x*Sum(b,E)=0, т.е. Z(x)=Sum(a,x,E)-Sum(b,x,E)=0 2)Дост.: пусть Z(x)=0, но y<x - решение, Ey - соответствующий набор рёбер для y; Z(y)=0 (из 1)); в силу минимального остова 0=Z(x)=Sum(a,x,E)-x*Sum(b,x,E)<=Sum(a,x,Ey)-x*Sum(b,x,Ey)=> Sum(a,Ey)>=x*Sum(b,Ey)>y*Sum(b,Ey) => Sum(a,Ey)-y*Sum(b,Ey)=Z(y)>0 - противоречие. Свойства: Пусть Z(x)=0. Тогда: 1)y<x <=> Z(y)>0 2)y>x <=> Z(y)<0 (Доказывается просто) Edited by author 22.11.2017 22:34 |
| whats wrong with this code?it say wrong answer | sina roozegar | 1493. One Step from Happiness | 22 Nov 2017 21:34 | 1 |
#include<iostream> using namespace std; int main() { int x, y; int sum1 = 0, sum2 = 0; char n = 'n'; cin >> x; int max = x + 1; int min = x - 1; for (int i = 0; i <3; i++) { y = max % 10; max = max / 10; sum1 += y; } for (int i = 0; i < 3; i++) { y = max % 10; max = max / 10; sum2 += y; } if (sum2 == sum1) { n = 'y'; }
y = 0; sum1 = 0; sum2 = 0; for (int i = 0; i <3; i++) { y = min % 10; min = min / 10; sum1 += y; } for (int i = 0; i <3; i++) { y = min % 10; min = min / 10; sum2 += y; } if (sum2 == sum1) { n = 'y'; } if (n=='n') { cout << "no"; } else { cout << "yes"; } return 0; } |
| I think this problem involves complex number operations | Shen Yang | 1765. Error 404 | 22 Nov 2017 13:05 | 3 |
choose k numbers k1,k2...km such that sigma(cos((2*ki+1)*pi/n))==0&&sigma(sin((2*ki+1)*pi/n))==0 that is sigma(cos((2*ki+1)*pi/n)+sin((2*ki+1)*pi/n)*i)==0 because cos(k*theta)+i*sin(k*theta)==(cos(theta)+i*sin(theta)^k so it is sigma(cos(pi/n)+i*sin(pi/n))^(2*ki+1)==0 I think this problem must involved this... is there O(polynomial)algo ? I only came up with a brute_force search idea..maybe it can pass.. brute_force search compnent part which is central symmetry Edited by author 22.11.2017 08:15 seems can turn to minimum cut problem because there are only two prime factor,I didn't see it... |
| WA 14 | kokrokro | 1736. Chinese Hockey | 21 Nov 2017 14:14 | 1 |
WA 14 kokrokro 21 Nov 2017 14:14 What is test # 14? Can anyone help me? Edited by author 22.11.2017 20:14 |
| (с) ???? | Anastasia Nani | 1001. Reverse Root | 20 Nov 2017 19:57 | 1 |
(с) ???? Anastasia Nani 20 Nov 2017 19:57 #include<stdio.h> #include<math.h> #define n 4 int main(){ int a[n]={100000000}; int i; for(i=0; i<n; i++) scanf("%d", &a[i]); for(i=n; i>0; i--){ printf("%.4f\n", sqrt(a[i]));} return 0; } |
| (с) ???? | Anastasia Nani | 1001. Reverse Root | 20 Nov 2017 19:48 | 1 |
(с) ???? Anastasia Nani 20 Nov 2017 19:48 #include<stdio.h> #include<math.h> #define n 4 int main(){ int a[n]={100000000}; int i; for(i=0; i<n; i++) scanf("%d", &a[i]); for(i=0; i<n; i++){ printf("%.4f\n", sqrt(a[i]));} return 0; } |
| WA 9 | vdeviatkov | 1752. Tree 2 | 20 Nov 2017 13:54 | 2 |
WA 9 vdeviatkov 19 Nov 2017 01:45 Can someone know the 9th test? the topic is closed, a simple bug |
| WA4!!HELP | elsukov43 | 1131. Copying | 20 Nov 2017 00:34 | 6 |
Wrong answer 4. HELP!!!! Edited by author 03.06.2016 17:42 Edited by author 03.06.2016 17:42 What did you try? What's your solution/idea so far? #include "iostream" using namespace std; int main() { int n, k, hours = 0, game = 1, free, i = 0, j = 0; cin >> n >> k; free = k; if (n == 1) hours = 0; else { while ((free > i) && (game < free) && (game <= n)) { i++; n -= i; hours++; game += i; } while (j < n-1) { hours++; j += k; } } cout << hours << endl; return 0; } Edited by author 03.06.2016 17:44 Wrong answer 4! Edited by author 03.06.2016 17:30 Edited by author 03.06.2016 17:41 |
| why?? | Shen Yang | 1529. Game of Squares | 19 Nov 2017 12:12 | 1 |
why?? Shen Yang 19 Nov 2017 12:12 same code visul C++ 2017 0.249s G++7.1 2.5s |
| WA #14 | MatrixDeity | 1297. Palindrome | 18 Nov 2017 00:56 | 5 |
WA #14 MatrixDeity 14 Nov 2017 21:05 Hi, everyone! I used Manacher's algorithm to solve this problem, but I got WA on #14 test. Can someone hint me, what could be the problem? It could be buggy implementation If just want to solve then you could do it with native algorithm, time limit is enough even for python Mahilewets Nikita, thanks you for your answer! I thought about the native solution already, but I want to solve it with Manacher's algorithm only. It is needed for increasing of my skills :) If someone has 14th test post it, please! OMG, I found my mistake :) This test was useful to me: 'babadada'. Right answer is 'adada' (not 'abada'). P.s. There is same problem at Codeleet. You may peek some test there :) Also my implementation of Manacher failed at test 5 And I decided to use naive |
| To admins: why don't you notify users about rejudge? | Alexey Dergunov [Samara SAU] | 1211. Collective Guarantee | 18 Nov 2017 00:52 | 1 |
|
| please give the code to java | pumpum1 | 1038. Spell Checker | 17 Nov 2017 14:19 | 1 |
please give the code to java please give the code to java |
| No subject | grisha_govno | 1758. Bald Spot Revisited 2 | 17 Nov 2017 13:19 | 1 |
Edited by author 18.11.2017 07:25 |
| WA but its working correct any ideas? | niur | 2023. Donald is a postman | 17 Nov 2017 00:46 | 2 |
#include<iostream> #include<cstdio> using namespace std; int main() { int n, a = 1, counter = 0; string s; cin >> n; for (int i = 0; i < n; ++i) { cin >> s; if (s[0] == 'A' || s[0] == 'P' ||s[0] == 'O' ||s[0] == 'R' && a == 2){ a = 1; counter++;} else if (s[0] == 'A' || s[0] == 'P' ||s[0] == 'O' ||s[0] == 'R' && a == 3){ a = 1; counter +=2;} if (s[0] == 'B' || s[0] == 'M' ||s[0] == 'S' && a == 1){ a = 2; counter++;} else if (s[0] == 'B' || s[0] == 'M' ||s[0] == 'S' && a == 3){ a = 2; counter++;} if (s[0] == 'D' || s[0] == 'G' ||s[0] == 'K' ||s[0] == 'T' || s[0] == 'W' && a == 1){ a = 3; counter +=2;} else if (s[0] == 'D' || s[0] == 'G' ||s[0] == 'K' ||s[0] == 'T' || s[0] == 'W' && a == 2){ a = 3; counter++;} } cout << counter; return 0; } You list D, G, K, T, W, but not J. |
| is this algo correct?? | Shen Yang | 1967. Programmer Casino | 16 Nov 2017 11:21 | 3 |
initially let result sequence to be 10* 10* 10* 0* means zero or more zeroes. every time choose two number and if we merge them produce a smaller number then we merge them. the procedure stops until we can't merge to get a smaller number is it correct?? seems to be.. Edited by author 16.11.2017 07:10 we should modify this algo: every time choose right most two number that we merge them can get a smaller number then we merge them,.... we must merge numbers from right to left.... seems to be more correct |
| Anyone crash test#2 | abc | 1471. Distance in the Tree | 14 Nov 2017 20:25 | 2 |
Test #2 contains graph with only one node |
| Random Test Cases | Aditya Singh | 1684. Jack's Last Word | 14 Nov 2017 17:28 | 1 |
aaaaa aaa No aaa aaaaa aaaaaaaaa No aaaa aaaaa aabaa aabaabaabaaaaabaa No aab aab aaba aa aabaa aabaa aabaabaab No aab aab aab abcabcabccs abcaabcaabcaa No abca abca abca a aabaa aabaabaaaa No aab aabaa aa |
| Time limit excedeed test 9 python | Mark_Komissarov | 1049. Brave Balloonists | 14 Nov 2017 13:54 | 1 |
What's wrong? I have 'time limit excedeed' in 9th test. import functools def pr(n): result = [] i = 2 now = 1 while n >= 1: if n % i == 0: now *= i n //= i elif n % i != 0 and now > 1: result.append(now) i += 1 now = 1 else: i += 1 if n == 1: result.append(now) return result def f(n): result = 0 i = 1 while i ** 2 < n: if n % i == 0: result += 1 i += 1 if i ** 2 == n: return 2 * result + 1 else: return 2 * result newList = [int(input()) for _ in range(10)] product = functools.reduce((lambda x, y: x * y), newList) print(functools.reduce(lambda x, y: x * y, map(f, pr(product))) % 10) |