Common BoardShow all threads Hide all threads Show all messages Hide all messages | AC in 0.015 | Aditya Singh | 1118. Nontrivial Numbers | 10 Feb 2018 15:29 | 2 | [code deleted] Edited by moderator 19.11.2019 23:40 Hi, Very good solution! Just one note, it doesn't affect AC, but: In D+=(i+N/i); if (i == N/i) you don't need to add both i and N/i, but just i. In this case result of check(N) will be 100% equal to triviality(N) in all cases. | for n = 10, k = 2, ans = 89. How?? | iOli | 1009. K-based Numbers | 10 Feb 2018 08:18 | 1 | | Test 26 | Vitaliy Herasymiv | 1866. Poetic Foot | 9 Feb 2018 20:43 | 3 | Test 26 Vitaliy Herasymiv 15 Oct 2011 15:07 Please, check test #26, it seems to be incorrect. Oh no, that test is correct! I got AC. | WA 4 | Bazeev Damir`~ | 1651. Shortest Subchain | 9 Feb 2018 19:53 | 1 | WA 4 Bazeev Damir`~ 9 Feb 2018 19:53 | Test 6 | Shorekh | 1131. Copying | 9 Feb 2018 04:11 | 2 | Test 6 Shorekh 20 Oct 2016 22:48 Re: Test 6 Siroj Matchanov [TUIT] 9 Feb 2018 04:11 Whoever gets Wrong Answer at 6th test, try to change your way of finding the power of two. My solution got WA#6 when I calculated power of two this way: power = ceil(log(x)/log(2)); Better calculate it by multiplying it. | what about Ramanujan's 1729 | Adkham | 1349. Farm | 8 Feb 2018 19:27 | 1 | I remember once going to see him when he was ill at Putney. I had ridden in taxi cab number 1729 and remarked that the number seemed to me rather a dull one, and that I hoped it was not an unfavourable omen. "No," he replied, "it is a very interesting number; it is the smallest number expressible as the sum of two cubes in two different ways." G.H.Hardy 1729 = 1^3 + 12^3 = 9^3 + 10^3 | what is wrong with my code ??? | Adkham | 1110. Power | 8 Feb 2018 02:23 | 1 | #include<iostream> #include<cmath> using namespace std; int func(int k, int n, int m) { if(n == 0) return 1; else return func(k, n-1, m)*k%m; } int main() { int n, m, y, x, i = 0; int b; bool flag = true; cin >> n >> m >> y; if((n >0 && n < 999) && (m > 1 && m < 999) && (0 < y && < 999)) { while(i < m) { x = func(n, i, m); if(x == y) { cout << i << ' '; flag = false; } i++; } if(flag) cout << "-1"; } else cout << "-1"; return 0; } Edited by author 08.02.2018 02:25 Edited by author 08.02.2018 02:27 | Solution is pretty easy | 2ch | 1109. Conference | 7 Feb 2018 21:51 | 1 | Firstly, the problem asks to find number of edges in minimum edge cover Secondly, the number of such edges plus the number of maximum matching equals to number of vertices, that is N + M Thirdly, you can find the number of max. matching easily with dfs-like algorithm (you can find code online). The answer is N + M - (number of max. matching) | what is the 30 test | Bekzat | 1820. Ural Steaks | 6 Feb 2018 23:31 | 3 | | TLE #21 | JohnDarkman | 2102. Michael and Cryptography | 6 Feb 2018 19:25 | 1 | TLE #21 JohnDarkman 6 Feb 2018 19:25 I get TLE on 21 test. What can you advise? | Example Testcase | Khanhhuy_19 | 2018. The Debut Album | 6 Feb 2018 18:47 | 2 | i think 212 in the Example test is wrong cause we have 2 remix of "I miss you" when the most remix that we can reach is 1 . Edited by author 21.01.2018 23:56 It says: "in a row". It means that there can be any number of remixes of each song, the most important part it that the number in each row doesn't;t have to exceed a for 1st and b for 2nd | Test | BdE | 1846. GCD 2010 | 5 Feb 2018 22:15 | 1 | Test BdE 5 Feb 2018 22:15 in: 9 + 10 + 10 + 10 - 10 - 10 + 5 - 10 - 5 + 123 out: 10 10 10 10 10 5 5 1 123 GL. Sqrt decomposition works fine in this problem. | as of Feb 2018, what is test #4? | LordPhantom | 1120. Sum of Sequential Numbers | 3 Feb 2018 01:39 | 1 | N = int(input()) if N == 1: print(1,1) exit() for P in range(round(N**0.5)+1,0,-1): A = (2*N - P**2 + P) / (2*P) if A % 1 == 0: print(int(A),P) exit() | Hint | Al.Cash | 1661. Dodecahedron | 2 Feb 2018 19:44 | 2 | Hint Al.Cash 3 May 2009 14:37 This problem isn't hard! Just use Burnside's lemma. One would need Polya enumeration theorem to obtain an explicit formula though. Well, the theorem is a generalization of Burnside's anyway. | Why dont work?C# | Artem | 1068. Sum | 2 Feb 2018 13:12 | 1 | using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication25 { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()), Sum=0; if (Math.Abs(N)<10000) { while (N != 1) { if (N > 1) { Sum = Sum + N; N--; } else { Sum = Sum + N; N++; } } } Console.WriteLine(Sum+1); } } } | Runtime error - Test 2 | Valentina | 1987. Nested Segments | 31 Jan 2018 23:23 | 1 | I've got Runtime error in Test 2. I've written the code in Java. Could anybody share the test case for the Test2? | I have WA 36 | arrammis | 1854. Negotiations with Parthians | 30 Jan 2018 05:02 | 2 | My solution pass's all tests presented here in the forum. But i get WA at 36 test, authors please help what's there???? <code> #include <iostream> using namespace std; int main() { __int64 n, i, a, b, c, maxC1 = 1, maxC2 = 1, maxC = 1; cin >> n; for (i = 1; i*i < 1000000; i += 2) { if (n % i == 0) { a = n/i; b = sqrtl((long double)a); c = sqrtl((long double)i); if (b*b == a && a > maxC1) { maxC1 = a; } if (c*c == i && i > maxC2) { maxC2 = i; } maxC = max(maxC1, maxC2); } } cout << maxC; return 0; } </code> Do I need to write own sqrt ? What the problem is ? Edited by author 22.01.2015 17:54 For test 36, make sure to use unsigned long longs to prevent overflow: 999999998000000001 999999998000000001 | Where difference? | Felix_Mate | 1191. Catch the thief! | 30 Jan 2018 01:05 | 1 | #include <iostream> using namespace std; const int kmax=105; int K[kmax]; int L,n; int R(int x, int y) { if(x%y==0) return x/y; else return x/y+1; } int main() { cin>>L>>n; for(int i=1;i<=n;i++) cin>>K[i];
if(n==1) { if(L<K[1]) cout<<"YES"; else cout<<"NO"; return 0; }
int t1=R(L, K[1])*K[1], t2=K[1]; if(t1==t2) t1+=K[1];
for(int i=2;i<=n;i++) { t2+=K[i]; if(t1<t2) { cout<<"YES"; return 0; } t1=t2+R(t1-t2,K[i])*K[i]; if(t1==t2) t1+=K[i]; }
cout<<"NO"; return 0; } and #include <iostream> using namespace std; const int kmax=105; int K[kmax]; int L,n; int main() { cin>>L>>n; for(int i=1;i<=n;i++) cin>>K[i];
if(n==1) { if(L<K[1]) cout<<"YES"; else cout<<"NO"; return 0; }
int t1=(L/K[1]+1)*K[1], t2=K[1];
for(int i=2;i<=n;i++) { t2+=K[i]; if(t1<t2) { cout<<"YES"; return 0; } t1=t2+(1+(t1-t2)/K[i])*K[i]; }
cout<<"NO"; return 0; } ????????????????????????????????????????????? | The sequence | ComebackSeason | 1490. Fire Circle | 30 Jan 2018 00:02 | 2 | How to compactly encode this sequence (or delta with ceil(round(x)))? | I do not understand this Test please explain to me | Axmadjon | 1918. Titan Ruins: Artful Manipulations | 29 Jan 2018 00:28 | 2 | HINT: you must read problem on english version. Перевод на русский язык плох. Нифига непонятно, о чём речь в 4 пункте. А вот в английской версии всё зашибись. Суть в следующем. Есть n рычагов, каждый рычаг можно поставить ровно в одно из n состояний. Изначально есть 1 монета. Пусть на некотором шаге имеется i монет (1<=i<=n). Если ничего не делать, то со временем станет i-1, i-2, ... , 1 монет. Можно применить зарядку (в любой момент). Пусть при применении зарядки i рычаг находится в состоянии j (1<=j<=n). Тогда число монет становится j. Нужно найти все такие состояния рычагов (т.е. вектор (x1,...,xn) : 1<=xi<=n), что с помощью использования некоторых зарядок можно получить n монет. Примеры: 1)n=2 все возможные комбинации: (1,1) (1,2) (2,1) (2,2) получить 2 можно 2 способами: (2,1) и (2,2) - в этом случае сразу получаем 2 монеты почему не подходят (1,1) и (1,2)? в этом случае снова станет 1 монета
2)n=4 комбинации из ответа: (4,*,*,*) -> кол-во=4*4*4 (3,4,1,*) -> кол-во=4 (3,4,2,*) -> кол-во=4 (3,4,3,*) -> кол-во=4 (3,*,4,*) -> кол-во=4*4 (2,3,4,*) -> кол-во=4 (2,4,*,*) -> кол-во=4*4 ответ=112 почему (3,4,2,*) даёт решение? Число монет меняется так:вначале 1 монета. Если не делать зарядку, то 1 монета так и будет. Если применить зарядку, то станет 3 монеты. Далее если не делать зарядку, то станет 2 монеты: потом можно сделать зарядку и получить 4 монеты либо не делать зарядку и получить 1 монету; если сделать зарядку, то получим 2 монеты: потом если не делать зарядку,то получим 1 монету, а если сделать зарядку, то получим 4 монеты. Edited by author 29.01.2018 00:31 |
|
|