| Show all threads Hide all threads Show all messages Hide all messages |
| Help! I can't find error | Felix_Mate | 1995. Illegal spices | 4 Feb 2017 23:36 | 1 |
My code: const nmax=111111; var a:array[1..nmax] of int64; n,k,p:longint; i,cnt,cntmax,max:longint; sum:int64; BEGIN readln(n,k); read(p);
for i:=1 to n-k do a[i]:=1; sum:=n-k; cnt:=n-k; cntmax:=1; max:=2;
for i:=n-k+1 to n do begin if(100*cnt<p*(i-1)) then begin inc(max); inc(cnt,cntmax-1); cntmax:=1; end else inc(cntmax);
a[i]:=max; inc(sum,max); end;
writeln(sum); for i:=1 to n do write(a[i],' '); END.
|
| problem 1086 | Ajana | 1086. Cryptography | 4 Feb 2017 15:59 | 2 |
#include<stdio.h> int main() { int n,i,j,c,t,T; scanf("%d",&T); while(T--) { scanf("%d",&n); for(j=2;;j++) { c=0; t=0; for(i=2;i<=j/2;i++) { if(j%i==0) { c++; break; } } if(c==0) t++; if(t==n) { printf("%d\n",j); break; } } } return 0; } why TLE?? Edited by author 04.02.2017 11:04 Edited by author 04.02.2017 11:05 Edited by author 04.02.2017 11:08 Error here: t=0. You wanted this: #include<stdio.h> int main() { int n,i,j,c,t,T; scanf("%d",&T); while(T--) { scanf("%d",&n); t=0; for(j=2;;j++) { c=0; for(i=2;i<=j/2;i++) { if(j%i==0) { c++; break; } } if(c==0) t++; if(t==n) { printf("%d\n",j); break; } } } return 0; } But your algo will get TL on test: 15000 15000 .... 15000 (15001 times) |
| WA 9 Java | keekkenen | 1002. Phone Numbers | 3 Feb 2017 23:57 | 1 |
Please, help some critical test case ps. I fix it ) Edited by author 04.02.2017 18:08 |
| WA 14 ???? Help | Ostap Korkuna | 1420. Integer-Valued Complex Division | 3 Feb 2017 23:50 | 4 |
I can't understand what is wrong? Maby something with calculations and rounding??? Can anyone help me? Thanks [code deleted] Edited by moderator 22.02.2006 00:48 correst your x and y to: [code deleted] Edited by author 21.11.2005 04:45 Edited by moderator 22.02.2006 00:49 Can you tell me how to solve this problem?? Утверждение: задача эквивалентна следующей: нужно найти все комплексные q с целыми коэффициентами, удовлетворяющие |a-bq|<|b|. Если |b|=0, то решений нет Иначе |b|>0. Тогда условие эквивалентно |a/b - z|<1. Пусть a=a1+b1i, b=a2+b2i, q=q1+q2i. Тогда получим |alfa/gamma-q1+i(beta/gamma+q2)|<1 <=> ((alfa-gamma*q1)/gamma)^2+((beta+gamma*q2)/gamma)^2<1, где gamma=a2*a2+b2*b2, alfa=(a1*a2+b1*b2)/gamma, beta=i(a2*b1-a1*b2)/gamma. Теперь просто можно пройтись по всем q1 и q2 (они меняются от -1+alfa/gamma до 1+alfa/gamma и от -1-beta/gamma до 1-beta/gamma) и проверить условие. |
| I got AC, but my algorythm is standart( O(m*2^n) ). How solve faster? (i need in idea) | Felix_Mate | 1326. Bottle Taps | 3 Feb 2017 21:08 | 3 |
Hi. I've also got AC with O(m*2^n), but it seems that it's a bit more fast. Here's an idea. Each set of taps or a combination of sets has corresponding bit mask. We have an array int minPrice[2^N]. Obviously, index is a mask, element — min price for buying such combination of taps. Initially the only !=0 elements are those each corresponding to one of predefined M sets. Then the DP comes. We go from 0-th element to the last (11...1 target). If i-th element !=0, we process it: a) if i corresponds to one of M predefined sets, we try to OR "i" with all younger mask with !=0 price. b) if i doesn't correspond to any predefined set, thus, it's a combination of some predefined sets, then we OR this "i" with younger predefined masks ONLY (not all younger "j" !=0). However, there's still a question to those guys who got AC in less than 0.1 second. Especially to those who did it in ~200 KB. |
| No subject | Felix_Mate | 1228. Array | 1 Feb 2017 17:12 | 1 |
Edited by author 01.02.2017 17:12 |
| WA Test#3 | vndd | 1563. Bayan | 1 Feb 2017 05:33 | 1 |
Edited by author 16.02.2017 22:39 |
| Unclear problem statement in russian | Sirko | 1326. Bottle Taps | 31 Jan 2017 15:21 | 1 |
"В первой строке записано число N — количество недостающих Петрову крышек (1 ≤ N ≤ 20)." vs "В последней строке перечислен минимальный набор крышек, который Петров намерен купить в любом случае." |
| Голд место это только первое? или первые н мест? | Mescheryakov_Kirill [SESC17] | 1868. Prediction Contest | 30 Jan 2017 22:59 | 2 |
|
| test for WA#8 | hoan | 1183. Brackets Sequence | 29 Jan 2017 06:37 | 7 |
input: ))(())(( output: ()()(())()() i hope it can help you. sorry for my poor english. GOOD LUCK!!! Hi, The output of my application for your test is the same. But the judge tell me WA#8 :S. try this input : [][] output : [][] hello,I get the same output as you said but yet i get WA#8.Any suggestions?! Try this (][)) .... answer should be ([][])() or (([][])) Thanks, man, that helped me :) |
| WA#3 | Rinotto | 1297. Palindrome | 27 Jan 2017 22:12 | 1 |
WA#3 Rinotto 27 Jan 2017 22:12 |
| WA #6 | Harry | 1998. The old Padawan | 26 Jan 2017 21:20 | 6 |
WA #6 Harry 5 Oct 2014 01:09 Please! Give me some tests. Me too!Have you solved this problem? Re: WA #6 SButterfly [Samara SAU] 7 Nov 2014 23:03 I have this WA too. Firstly, I used binary search to find the last element, which didn't fall. And my mistake was: if (currentSum == k) return med; the corrent ones: if (currentSum == k) return med-1; And for case, where we haven't found exactly k sum: .. }//end of binary search int answerIndex = l; int sum = getSum(left, lastAdded Index); if (sum <= k){ answerIndex = l - 1; } return answerIndex; But now I have TL11 |
| Test 2 note | ToadMonster | 1211. Collective Guarantee | 26 Jan 2017 16:09 | 1 |
Was wrong. Sorry Edited by author 26.01.2017 16:13 |
| WA 4 pls help | Herman | 2056. Scholarship | 26 Jan 2017 13:49 | 2 |
#include <iostream> #include <cmath> using namespace std; int main() { int n,s=0; bool f=0; float t; cin>>n; int M[n]; for( int i=0;i<n;i++) { cin>>M[i]; s+=M[i]; if(M[i]==3) f=1; } t=s/float(n); if(s/n==5) cout<<"Named"; else if(f==1 || t<4.5 ) cout<<"None"; else if(t>=4.5) cout<<"High"; } Nothing about the "common" scholarship... |
| Despair and Test Case #6 | Aleksandr | 1881. Long problem statement | 25 Jan 2017 20:06 | 2 |
I have successfully completed all tests given in the "Discussion" but for some reason test number SIX does not think so. Maybe somebody can give me the inputs and the expected answer? Much appreciated! BUMP Ok, maybe after looking at the code anyone could tell me anything :) public class Timus {
public static void main (String []args) throws IOException { PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String mn[] = in.readLine().split(" "); byte totalPages = 1, h = Byte.parseByte(mn[0]), // lines on a page currentLines = 1, w = Byte.parseByte(mn[1]), // symbols in a line currentSymbols = 0; short n = Short.parseShort(mn[2]);// ALL words String s = ""; // current word
for (int i = 0; i < n; i++) { s = in.readLine(); if (currentSymbols + s.length() <= w) currentSymbols += s.length() + 1; else { currentSymbols = (byte) (s.length() + 1); if (currentLines + 1 <= h) currentLines++; else { totalPages++; currentLines = 1; } } }
out.print(totalPages); out.flush(); } |
| No subject | MrBones | 1155. Troubleduons | 25 Jan 2017 08:45 | 1 |
Edited by author 25.01.2017 09:23 |
| if you have WA3 | MrBones | 1004. Sightseeing Trip | 25 Jan 2017 04:16 | 1 |
Try this test: 6 6 1 2 1 2 3 100 3 1 99 4 5 150 5 6 1 6 4 1 -1 Answer: 4 5 6 |
| Clarification on the task | Aleksandr | 1876. Centipede's Morning | 24 Jan 2017 17:25 | 2 |
Please, correct me if I am wrong. In the worst case, first of all our centipede will take 40 right slippers (40slip * 2sec) After that it will take all of the remaining right slippers ((rightSlippers-40) * 2sec) Then, because there are no right slippers left, it will take 40 left slippers(40slip * 1sec) And finally take remaining left slippers and throw them away ((leftSlippers-40) * 2sec) I guess I didn't understand the task correctly, may someone explain it to me? Update: I guess I should of have searched a little more, I found what is the case. If any of you are interested the solution is that there may be another situation where we have >40 left slippers, so first we take 39 right ones, then 40 left ones, throw remaining lefts away and take our last right. Depending on which one is longer, you may use this solution or the one I posted before. P.S. of course you don't have to throw away the remaining slippers once all legs are dressed, my bad. |
| WA #4 , help me plz.. | Vonni | 1875. Angry Birds | 24 Jan 2017 00:23 | 1 |
What is it? So, in russian vertion of problem x[i]>0, y[i]>0... is it true? Whether is there any mistake while doing translation from English to Russian? Where should I seek an error? Edited by author 24.01.2017 00:30 Edited by author 24.01.2017 00:30 |
| [To admins] Differences between translations and mistakes in the problem statement | labirint (mirea) | 1347. Blog | 23 Jan 2017 22:07 | 1 |
Things I've noticed: 1) (En) There is no other tags in the text of blog (Ru) В тексте блога нет других тэгов <blog> I believe the English translation implies that the text of the blog can't contain any tags at all except for <blog> 2) (En) string of small Latin between the symbols Should it be "string of small Latin _letters_" ? 3) (En) consists a name of the blogger Shouldn't it be 'consists of the name of' or 'contains the name of'? 4) (En) The input contains only small and capital Latin letters, digits, symbols greater than, lower than, slash, full stops, commas and underlining symbols. Input may also contain line feeds - they're not mentioned in both translations. 5) (En) a list of those who’s blogs Should be "whose", not "who's". 6) (En) you are to output s string “1: ” "s string" -> "a string" 7) (En) A tag is the line that consist of "consist" -> "consists" |