| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| oddiygina kichik harflarning ixtiyoriy ravishda to'ldirsangiz kifoya!!!! | Adhambek | 1219. Symbolic Sequence | 9 ноя 2018 15:52 | 2 |
Buning uchun rand() funksiyasidan foydalaning. masalan: 1000000 ta ababababbabab.....asdbasdsajkdbksajbdjkasbdkjbskfjbaksjdbfkjsad. faqat ixtiyoriy ravishda bo'lsin k = rand()%26 + 97 ; qilib chiqaring shuni uzi kifoya Edited by author 15.06.2013 11:32 |
| Python Wrong answer. Первый раз на этом сайте. Что не правильно? | Altynbek | 1001. Обратный корень | 9 ноя 2018 15:00 | 2 |
intxt = input() for i in intxt.split()[::-1]: print('%.4f' % int(i) ** 0.5) IIRC, Python's input() reads only one line. You should probably do this for every line in sys.stdin. Well, rarely do I write solutions in Python so I might be wrong. |
| For C++ Users | 0blivium | 1161. Stripies | 9 ноя 2018 03:58 | 1 |
Use the priority queue data structure. |
| WA #5, WA #6 | 👨🏻💻 Spatarel Dan Constantin | 2096. Всё включено | 9 ноя 2018 01:22 | 1 |
input: 3 3 1 1 1 0 0 2 1 3 1 2 1 1 1 3 0 0 0 1 2 1 0 0 output: - - 1 |
| Runtime Error(access Violtion) HELP!! | Hrant Nurijanyan [RAU] | 1370. Волшебник | 8 ноя 2018 13:03 | 5 |
#include <iostream> #include <string> using namespace std; int main() { string a[3000]; int n; int m; cin >> n; cin >> m; for (int i = 0; i < n; i++) { cin >> a[i]; } int j = m; for (int i = 0; i < 10; i++) { cout << a[j]; j++; if (j == n ) { j = 0; } } cout << endl; return 0; } add ""cout<<flush;"" in diffrent places and see if it works(sometimes solves the error) string a[3000]; Hmm. It's really funny to use string array for containing int values. Edited by author 13.04.2014 14:08 1 ≤ M ≤ 32767. and you are trying to print a[j] which j >= m m can be above n; m can be above a length. To put big arrays on stack is a bad idea. a should be dynamic array or vector. |
| WHY WA3??? PLEASE HELP!!!! | Furious Wolf | 1370. Волшебник | 7 ноя 2018 19:49 | 12 |
I THINK THAT MY PROGRAM MUST HAVE AC BUT WA3 WHAT THE 3 TEST???? PLEASE POST TEST №3!!!!!!! Edited by author 13.05.2007 15:12 blonde :) ha ha. It is joke about WRITING MESSAGES WITH CAPS LOCK ON Which difference write messages WITH CAPS LOCK ON or with caps lock off? Please post some tests! I dont know why my program had WA :( 12 335 1 2 3 4 5 6 7 8 9 0 7 7 answer 7123456789 Thanks Furious Wolf 13 май 2007 15:06 Thanks for the test, I've got AC! #include <iostream> #include <algorithm> using namespace std; int main() { int i,n,m; cin>>n>>m; long int *a=new long int [n]; for(i=0;i<n;i++) cin>>a[i]; rotate(a,a+m,a+n); long int b[10]; for(i=0;i<10;i++) b[i]=a[i]; for(i=0;i<10;i++) cout<<b[i]; cout<<endl; return 0; } the test of Alias doesn't work,but why?What is incorrect in code? Already got AC....this code is right,you only need to decrease the quantity of ranges by decreasing the "m".......make m<n and everything will be ok ;) Or you can use "%" :) And yes,i'm necroposter ))) |
| easy solution for python | Yucheng | 1567. SMS-спам | 4 ноя 2018 08:37 | 1 |
dic={'a':1,'d':1,'g':1,'j':1,'m':1,'p':1,'s':1,'v':1,'y':1,'.':1,' ':1, 'b':2,'e':2,'h':2,'k':2,'n':2,'q':2,'t':2,'w':2,'z':2,',':2, 'c':3,'f':3,'i':3,'l':3,'o':3,'r':3,'u':3,'x':3,'!':3} m=input() total=0 for i in range(len(m)): total+=dic[m[i]] print(total) |
| easy solution for python | Yucheng | 1083. Факториалы!!! | 3 ноя 2018 20:50 | 1 |
a,b=input().split() n=int(a) k=len(b) temp=n t=k while temp-k>0: n*=(temp-k) k+=t print("%d"%n) |
| AC with long double | Shen Yang | 1594. Сокровища ацтеков | 2 ноя 2018 19:23 | 7 |
deleted Edited by author 21.10.2017 21:07 Why not std:: complex? I have not read the code very carefully, maybe miss something important Maybe not possible to made it long double? it involves with Chebyshev polynomial U(x) is Chebyshev polynomial Um(i*An/2)= i*An*Um-1(i*An/2)-Um-2(i*An/2) i is unit imaginary number An is a n*n matrix Aij==1 if and only if abs(i-j)==1. sqrt(det(Um(i*An/2)) is the answer.. I use long double because I need to judge the sign of sqrt(ans^2) Edited by author 21.10.2017 09:46 Delete the code please. Posting AC code here violates the rules. You can explain your idea (which is not recommended either) 100 100 exactly result: 211296849512315762188619578574048657110653043609449472144725843973442479614058285996396387014570402447830177110492225916018306620473309898122553032154580078102848452707439935767561964432764309438889871659414420572001206784720890894593722611533746574726650832697664485530063095995962974740556608440361525520881534009295321784945692404915331234788462418215336479515406547891566477310928856298254153861327506039317299734093964771367687300616477954739907701770903890588939771176356807995358624375906635501695115399580918628783125903772434369374398388373031207325810190683145008704318854255120274024753774893652675256050843161415941752800234892558301824773136514256893938068687029095739098286424428752900415743287209790876036884080292271611832363684077924978489349099638343563775430445274281910983984807471952213028600596500243377496299053827784481766322799764412944529657092342282080566012889979741375614523723377108743228485047911163027695369684514018557778209543315449702696764786683247792132799136211383970764610828007749277178715661259454260357449248458683734007683846942145977953891807183259007702385978401831386444472112720952063414073905105738447216839800171442748174691808886777635485410113868685679678838952355104065272999262338505349001538065924096 |
| No subject | 🦄imosk72🦄[GTGU] | 1422. Светлячки | 2 ноя 2018 18:55 | 1 |
i think test set is not full. my AC soulution uses floating arithmetic and does not work correctly on tests like 3 0 0 0 1 1 1 100000 100000 99999 right answer should be 2? |
| This testcase helped me to fix WA13 | tepamid | 1964. Китайский язык | 1 ноя 2018 13:14 | 1 |
|
| WA17 | Ag'abek | 2021. Страшно интересно! | 1 ноя 2018 02:21 | 8 |
WA17 Ag'abek 11 окт 2014 17:24 Re: WA17 Angel Gonzalez 11 дек 2014 19:25 Can anybody share that testcase? Here's a test case: 4 6 6 5 0 0 2 1 2 Which answer is correct for this test? My output (I also have WA17): 4 1 3 2 1 4 2 3 Why is it wrong? Re: WA17 Jane Soboleva (SumNU) 7 мар 2016 16:01 Okay, so i finally figured it out. There was a phrase «For example, if six challenges until the end “Oozma Kappa” is forty points ahead, the audience at the stadium stands will just lose interest to the game.», which made me think that to "keep in suspense", on each step, i should choose such pair, that the current total sum is as close to zero as possible. However, this approach gives WA17. The proper approach is to keep, for as long as possible, such situation that if the first team gets all 6's for the remaining participants, and second gets all 0's, the first team wins; respectively, if 2nd team gets all 6's for the remaining participants, and 1st gets all 0's, 2nd team wins. An example test: 11 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 0 0 0 0 0 Wrong WA17 approach gives 6 6 6 6 6 5 5 5 5 5 5 6 6 6 6 6 6 0 0 0 0 0 but last two rounds aren't interesting, because at that point 1st team has 50, and 2nd team has 36 points, and even if 2nd team gets all 6's for last two, and 1st all 0's, it's still 50:48 and 1st team wins. One of the right answers is 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 0 0 0 0 0 Before last two rounds, we have 48:36, and 2nd team can potentially get all 6's on last two rounds for a draw 48:48; however, after a next round we have 54:36, and only then gets clear that 2nd team isn't going to win. Cheers to Felix_Mate for a test and nice explanation. Re: WA17 Smilodon_am [Obninsk INPE] 1 ноя 2018 02:21 > Which answer is correct for this test? > My output (I also have WA17): > 4 1 > 3 2 > 1 4 > 2 3 > Why is it wrong? This answer is wrong. We understand that the first team is a winner after the third round: 4 1 -> 0 + (0-0) = 0 3 2 -> 0 + (5-2) = 3 1 4 -> 3 + (6-2) = 7 - we understand that the first team is a winner 2 3 -> +(6-1) = 12 Correct answer is, for example: 4 2 3 4 2 3 1 1 Explanation - we understand that the first team is a winner only after the last (forth) round: 4 2 -> 0 + (0-2) = -2 3 4 -> -2 + (5-2) = 1 2 3 -> 1 + (6-1) = 6 - we don't know who is a winner 1 1 -> 6 + (6-0) = 12 Edited by author 01.11.2018 02:24 Edited by author 01.11.2018 02:24 |
| Some clarifications | knok16 | 1438. Time Limit Exceeded | 31 окт 2018 20:25 | 1 |
A nice task for implementation, but the description is quite tricky sometimes. What if Program Counter went out of last instruction? - it is ok, you can think about it as normal termination by END command Is NOP count towards overall operations count? - no, empty lines and only-label lines do not contribute to the overall number of executed commands Are labels case sensitive? - no Are operands case sensitive? - no Are variable names case sensitive? - yes What about int32 overflow? - guaranteed that there are no overflows What about % operation? - the result of A % B operation is such C that 0 <= C < B and exist some integer Q: A = Q * B + C What if 10_000_000th command is END command? - The end command terminates the program Can variable name start from digit? - no |
| Why Runtime error (Stack Overflow)??? | Iqramul Islam | 1001. Обратный корень | 31 окт 2018 17:01 | 5 |
#include <iostream> #include <math.h> using namespace std; void square() { long long int n; scanf("%lld", &n); if(n!=-1) { square(); printf("%.4f\n", sqrt(n)); } return; } int main() { square(); return 0; } http://acm.timus.ru/help.aspx?topic=cpp&locale=en Visual C++ Only. In order to increase the size of a stack and to avoid its overflow when using a “deep” recursion, you should use a special directive (in the example, the size of the stack is set to be 16 MB): #pragma comment(linker, "/STACK:16777216") sorry i don't understand .. how to set the size of the stack??? If you can explain... it might help me..... #pragma comment(linker, "/STACK:16777216") Put the line above in the very beginning of your program, that all. You shouldn't touch stack size at all. You shouldn't implement algorithms with linear depth of recursion, not more then logarithmic depth. You shouldn't place big arrays/objects on stack. Imagine you have 1-2K stack at all. You should get/implement stack data structure and solve problem using it. |
| PLZ HELP! (WA#1) | v131v [Kungur] | 1007. Кодовые слова | 30 окт 2018 16:07 | 1 |
My program works with tests like this: 4 0 00 0 10 11 And my program give right answers but WA#1. That my code, whats wrong?? #include <bits/stdc++.h> using namespace std; int n; string ans,q; int main() { cin >> n; while (!cin.eof()) { //while not eof reading getline(cin,q); //read 1 line ans = ""; for (int i = 0; i < q.length(); i++) //remove all except 0 and 1 if (q[i] == '0' || q[i] == '1') ans += q[i]; if (ans.length() < n-1 || ans.length() > n+1) //if its empty continue continue; int pos_sum = 0; for (int i = 0; i < ans.length(); i++) { //count sum of positions if (ans[i] == '1') { pos_sum += i+1; } } if (ans.length() > n) { //if there 1 unnecessary element check all bool fg = false; //elements and remove him for (int i = 0; i < ans.length(); i++) { int loc_pos_sum = 0; if (fg) { cout << ans[i]; continue; } for (int j = 0; j < ans.length(); j++) { if (j == i) continue; if (ans[j] == '1') loc_pos_sum += j+1 - int(j >= i); } if (loc_pos_sum % (n+1) == 0) { fg = true; } else { cout << ans[i]; } } } else if (ans.length() < n) { //if there 1 removed element bool fg = false; //check all positions for him for (int i = 0; i <= ans.length(); i++) { int loc_pos_sum = 0; if (fg) { cout << ans[i]; continue; } for (int j = 0; j < ans.length(); j++) { if (ans[j] == '1') { loc_pos_sum += j+1 + int(j >= i); } } if (loc_pos_sum % (n+1) == 0) { cout << 0; fg = true; } if ((i+1+loc_pos_sum) % (n+1) == 0) { cout << 1; fg = true; } cout << ans[i]; } } else { //if '0' replaced to '1' check all bool fg = false; //elements and replace for (int i = 0; i < ans.length(); i++) { if (ans[i] == '1' && (pos_sum-i-1)%(n+1) == 0 && !fg) { cout << 0; fg = true; } else { cout << ans[i]; } } } cout << "\n"; } return 0; } Edited by author 30.10.2018 16:07 |
| alternative answers are not accepted | ErikR | 1007. Кодовые слова | 30 окт 2018 15:14 | 3 |
For some inputs multiple answers are possible, e.g.: 4 1011 has two possible answers: 1111 and 1001. However only 1001 seems to be accepted. Either the wording of the problem should be changed or the alternative answers should be accepted. Sorry - I was mistaken about the rules - 1111 is not an answer for 1011. Why 1111 isn't an answer for 1011? |
| WA4 Python 3, Help pls! | Moshkov Danil | 1837. Число Исенбаева | 30 окт 2018 09:36 | 2 |
Somebody can give me test case 4? I don't understand why it's wrong answer... Edited by author 30.10.2018 11:59 Edited by author 01.11.2018 09:17 |
| Why Runtime error(access violation) | Iqramul Islam | 1086. Криптография | 29 окт 2018 23:46 | 1 |
#include <iostream> #include <math.h> using namespace std; int Prime[15000], nPrime; int mark[15000]; void sieve(int n) { int i, j, limit=sqrt(15000)+2; mark[1]=1; ///mark is not prime...so... for(i=4; i<=n; i+=2) mark[i]=1; Prime[nPrime++]=2; for(i=3; i<=n; i+=2) if(!mark[i]) { Prime[nPrime++]=i; if(i<=limit) { for(j=i*i; j<=n; j+=i*2) mark[j]=1; } } } int main() { sieve(15000); int n; cin >> n; int arr[2000]; //cout << Prime[n-1] << endl; for(int i=0; i<n; i++) { cin >> arr[i]; } for(int i=0; i<n; i++) cout << Prime[arr[i]-1] << endl; return 0; } |
| TEST#4 (attention) | Barrett | 1601. АнтиКАПС | 28 окт 2018 18:22 | 7 |
HHHHHH.KJDFDKJ(newline) ADFFG right answer
Hhhhhh.Kjdfdkj adffg I WA here for five times Edited by author 25.07.2008 08:43 Edited by author 25.07.2008 08:54 My program answers right on this, but still WA#4 Twenty times THANK YOU!!!! Edited by author 28.10.2018 18:23 Edited by author 28.10.2018 18:23 |
| Wa 3 | MSDN | 1441. Из истории банка Гринготтс | 26 окт 2018 20:46 | 2 |
Wa 3 MSDN 21 май 2010 20:50 Re: Wa 3 👨🏻💻 Spatarel Dan Constantin 26 окт 2018 20:46 This might help: input: 4 4 1 2 1 4 2 3 4 3 output: 1 1 4 3 2 1 |