| Show all threads Hide all threads Show all messages Hide all messages |
| Can somebody give me the whole explanation to this problem. Thanks beforehand! | Sanatbek_Matlatipov | 1573. Alchemy | 24 Nov 2016 16:01 | 2 |
Can somebody give me the whole explanation to this problem. Thanks beforehand! If you have two different sets A = {a1, a2, a3} and B = {b1, b2, b3, b4} then we have |A| * |B| = 3 * 4 = 12 ways to choose a pair (a[i], b[j]). i\j b[1] b[2] b[3] b[4] a[1] [1,1] [1,2] [1,3] [1,4] a[2] [2,1] [2,2] [2,3] [2,4] a[3] [3,1] [3,2] [3,3] [3,4] Modern language solution looks like that: map<string, int> cnt; for (auto color : {"Blue", "Red", "Yellow"}) cin >> cnt[color]; int colors; cin >> colors; int ways = 1; for (int i = 0; i < colors; i++) { string color; cin >> color; ways *= cnt[color]; } cout << ways; Edited by author 24.11.2016 16:04 Edited by author 24.11.2016 16:07 |
| about test case 4. | Shen Yang | 1536. Delights of Pipe-weed | 24 Nov 2016 12:35 | 4 |
Why number of digits of b is less than number of digits of a1 or a2, and answer is not Impossible, I output Impossible but WA. can we output leading zeroes?? oops seems you can remove all matches... what's the result of test 4: 12+4456=579 4 anyone help? I know 123+456=579, it is a reading comprehension problem.... |
| WA#5 | ILHOMJON | 2102. Michael and Cryptography | 23 Nov 2016 02:35 | 1 |
WA#5 ILHOMJON 23 Nov 2016 02:35 |
| The means of K and N! | HaiyangZheng | 1009. K-based Numbers | 22 Nov 2016 11:19 | 7 |
My English is poor, but I read it by a large time and I understood. N=2,K=10 ==>it's a "2 digits 10-base" 10,11,...98,99... in Chinese "2位的十进制数字" if k equal to 30 and n equal to 2 , numbers are 30 , 31 , 32 , 33 , .......,99 is it true? Edited by author 10.10.2012 23:50 Edited by author 10.10.2012 23:50 10 based notation of 10 is 10 but 2 based notation of 10 is 1010 I understand if k equal to 30 and n equal to 2 , numbers are 30 , 31 , 32 , 33 , .......,99 is it true? Edited by author 10.10.2012 23:50 Edited by author 10.10.2012 23:50 I don't understand. How can k equal to 30... In statement there is limit 2 ≤ K ≤ 10; N位数长,K进制,的所有数字中,不包含两个连续0的所有数字的个数。 oh my god!i like your answer! |
| No subject | JamesBond_007 | 1354. Palindrome. Again Palindrome | 22 Nov 2016 09:50 | 1 |
Help me WA4? #include <iostream> #include <string> #include <string.h> #include <algorithm> using namespace std; string S, ss, s; int k, l, r, mid; int main(){ cin >> S; int n = S.size(); if(n == 1){ cout << S; return 0; } for (int i = n - 1; i >= 0; i --){ k = n - i; if(i - k >= 0){ ss = S.substr(i, k); s = S.substr(i - k, k); reverse(s.begin(), s.end()); //cout << ss << ' ' << s << endl; if(ss == s){ l = i - k; mid = i; r = i + k; continue; } } k --; if(i - k >= 0){ ss = S.substr(i + 1, k); s = S.substr(i - k, k); reverse(s.begin(), s.end()); //cout << ss << ' ' << s << endl; if(ss == s){ l = i - k; mid = i; r = i + k; } } } //cout << l << ' ' << r << endl; if(!l && !r || (l == 0 && r == n - 1)){ s = S.substr(0, n - 1); cout << S; reverse(s.begin(), s.end()); cout << s; } else{ s = S.substr(0, l); reverse(s.begin(), s.end()); cout << S << s; } return 0; } |
| illegal test data | Shen Yang | 1952. To Kill the Dragon | 22 Nov 2016 06:23 | 4 |
problem description said dragon will not use breath two times, but test 21 there is at least three breath in the input file... hope admin can fix it.. oops I misunderstood "in a row" is "in a row" means cosecutive?? I think we must use O(2^20*10) dynamic programming ,because there maybe two breath in a row brute_force will definitely got TLE |
| WA#28 | Влад | 2102. Michael and Cryptography | 22 Nov 2016 02:28 | 1 |
WA#28 Влад 22 Nov 2016 02:28 |
| WA#11 | Anton | 1302. Delta-wave | 22 Nov 2016 00:01 | 2 |
WA#11 Anton 16 Aug 2012 07:09 Don't know, what else to test ... Any ideas? Re: WA#11 AGrigorii [Yaroslavl SU] 🔥 22 Nov 2016 00:01 |
| AllWhoWantsToSolveThisProblem | Felix_Mate | 2109. Tourism on Mars | 21 Nov 2016 21:45 | 2 |
I think many people can not solve this problem because they do not have enough knowledge. You should know "Problem LCA" and "Segment Tree" that to solve the problem. My algo is O(n*sqrt(n)+m*log(n)), but i can solve for O(n+m*log(n)) (LCA can be solved for O(1) with preprocess or sqrt(n) without preprocess). P.S. What is the optimal asymptotic behavior? Edited by author 20.11.2016 23:27 Edited by author 20.11.2016 23:27 Edited by author 20.11.2016 23:28 Well, there were quite a lot of LCA + segment tree problems by now, so by now people mostly should know what that is :) As for me, i just took my solution to http://acm.timus.ru/problem.aspx?space=1&num=1471 and only had to modify it very slightly. Just, in there you had to operate with only minimums, and here you need to find a minimum in a certain range of your array of minimums, so there's that additional layer of minimums. |
| WA 18 ? | bayram | 1495. One-two, One-two 2 | 21 Nov 2016 20:30 | 2 |
|
| java ac | pay_all_for | 1725. Sold Out! | 21 Nov 2016 12:23 | 3 |
java ac pay_all_for 3 Aug 2014 07:02 import java.util.Scanner; public class Sold_Out { public static void main(String[] args){ Scanner scan = new Scanner(System.in);
int n = scan.nextInt(); int k = scan.nextInt();
if(n<3){ System.out.println(0); return; }
System.out.println(Math.max(k - 1, n - k) - 2); } } your programm works only because of weak tests. for example: 3 1 your answer is 0, but the correct one is 1. 1 _ _ 1 _ 3 1 2 3 -> there is 1 person from both sides and the distance to number 2 is equal, so in the worst case the person will hit vasya. Edited by author 13.01.2016 01:14 Edited by author 13.01.2016 01:14 |
| sample output | 140701425 | 2104. Game with a Strip | 20 Nov 2016 13:37 | 1 |
Could anyone give me some sample input and output? Thanks a lot. |
| wrong ? | Vadim | 2101. Knight's Shield | 20 Nov 2016 11:57 | 2 |
Nope. The only inscribed rectangle with area=50 doesn't contain hole. Note, that there are only 4 possible rectangles in the solution. |
| Hint | Takanashi Rikka | 1118. Nontrivial Numbers | 20 Nov 2016 01:52 | 4 |
Hint Takanashi Rikka 26 Feb 2016 09:12 Calculates sum of divisors. O(lim * log(lim)). for(int i = 2; i <= lim; ++i){ ++s[i]; for(int j = i + i; j <= lim; j += i) s[j] += i; } Maybe I don't understand it clear, but I think it will get TL. Difficult of this algorithm = O(n^2) No, it's O(n log n). Learn some math. |
| long is not enough | AfraidDiablo | 1010. Discrete Function | 20 Nov 2016 00:09 | 2 |
In C++, you'd better use "long long" instead of "long". |
| Ошибка в исходном примере? | jazator | 2104. Game with a Strip | 19 Nov 2016 18:16 | 2 |
4 BBAA BABB = Bob Почему в исходном примере выигрывает Боб? Если при первом сгибе получаем полоску АА, значит должна выиграть Алиса... Почему нет? There is information:"Если после очередного сгиба полоска стала полностью одноцветной".It's mean, both of sides needs to have one color |
| Board of directors | Emiliyan Greshkov | 2103. Corporate Mail | 19 Nov 2016 15:45 | 2 |
Can members of the director board be subordinates? For example, is 6 a subordinate of 3? Yes, 6 is a subordinate of 1, 2, and 3. Edited by author 19.11.2016 15:45 |
| если отправитель равен получателю | the_art_of_war | 2103. Corporate Mail | 19 Nov 2016 15:41 | 2 |
Для теста 5 5 что нужно вывести 0 2 5 5 или 0 1 5 "An employee can send a memo only to another employee. The route of memo can consist of one employee." So the answer should be 0 1 5. |
| WA#4 | Giorgi | 1423. String Tale | 19 Nov 2016 03:00 | 1 |
WA#4 Giorgi 19 Nov 2016 03:00 A can't understand what's the problem and why I don't pass it. Help me, please. |
| What is 56th test | Mukhammadali | 2011. Long Statement | 18 Nov 2016 20:52 | 1 |
|