Common BoardShow all threads Hide all threads Show all messages Hide all messages | WA #1 | SeJIya | 1050. Preparing an Article | 20 May 2014 04:00 | 1 | WA #1 SeJIya 20 May 2014 04:00 | WA#8 | b108 | 1754. Explosion in a Pyramid | 19 May 2014 20:25 | 2 | WA#8 b108 27 Jan 2014 21:31 If you have WA#8 then check that m >= h Thanks a lot. if m<h then writeln('NO'). | Test 10 | Neo Nomaly | 1506. Columns of Numbers | 19 May 2014 14:47 | 6 | Test 10 Neo Nomaly 22 Jan 2007 10:01 WA 10. Give this test please... Have trouble with this test too... and one question: if input is like that: 7 6 1 2 3 4 5 6 7 should be output like that: 1 3 4 5 6 7 2 or that: 1 3 5 7 2 4 6 The answer is: 1 3 5 7 2 4 6 Remember about the correct number of spaces. Re: Test 10 Phan Hoài Nam - Đại học Ngoại ngữ Tin Học TP.HCM 11 Mar 2009 15:56 My AC program show : 1 3 4 5 6 7 2 it is incorrect answer or test >the columns have the same height with the possible exception of the last column, which may be shorter This test is incorrect. Timus Online Judje Team likes give people incorrect tests. | A misprint in statement | urusant | 1289. One Way Ticket | 19 May 2014 10:56 | 1 | The second word should be "crowd", according to the Russian translation. | Can you give me test data&//В чем дело? Пролетает то на первом, то на втором тестах. Хотя дома проверку проходит. Можете ли дать мне данные для проверки? | Evgeniy_Rus | 1297. Palindrome | 19 May 2014 01:07 | 1 | var a:array[1..1000] of string; S, pol:string; N, i, j, dlina:longint; function Sum(i, j:integer):string; var k:string; var i1:integer; begin k:=''; for i1:= i to j do k:=k+a[i1]; Sum:=k; end; function Sum1(i, j:integer):string; var k:string; var i1:integer; begin k:=''; for i1:= j downto i do k:=k+a[i1]; Sum1:=k; end; begin readln(S); N:=length(S); for i:= 1 to N do a[i]:=copy(lowercase(S), i, 1); dlina:=0; for i:= 1 to N-1 do begin for j:= i+1 to N do if (Sum(i, j)=Sum1(i, j)) and (length(sum(i, j))>dlina) then begin pol:=Sum(i, j); dlina:= length(sum(i, j)); end; end; writeln(pol); end. | WA #5, why !! :-( | simon.abdullah | 1350. Canteen | 18 May 2014 18:24 | 1 | I always get WA in #5 here is my code, somebody help me please. <code> #include<stack> #include<iostream> #include<algorithm> #include<vector> #include<list> #include<iterator> using namespace std; int getSafe(vector<string> a,int an, vector<string> b, int bn){ int d=0; for(int i=0;i<an;i++){ for(int j=0;j<bn;j++) if(a[i]==b[j]){ d++; break; } } return d; } struct ve{ vector<string> v; }; int main(){ int n,N,m; cin>>N; string str; vector<string> menu; for(int i=0;i<N;i++){ cin>>str; menu.push_back(str); } cin>>n; int a,b; cin>>b; vector<string> fMenu; for(int i=0;i<b;i++){ cin>>str; fMenu.push_back(str); } int i=0; int nums[102]; ve res[102]; while(i<n){ cin>>a; nums[i]=a; for(int j=0;j<a;j++){ //cout<<"d"; cin>>str; //cout<<"s"; res[i].v.push_back(str); } i++; } cin>>m; for(int i=0;i<n;i++){ int x=getSafe(res[i].v,nums[i],fMenu,n); int c=getSafe(menu,N,res[i].v,nums[i]); if(x-nums[i]==0) cout<<"YES\n"; else if(N-b-nums[i]+x-m<0) cout<<"NO\n"; else cout<<"MAYBE\n"; } return 0; } </code> | test #3 | yarmet | 1917. Titan Ruins: Deadly Accuracy | 18 May 2014 17:52 | 1 | кто-нибудь знает какой 3 ий тест ? Уже 7ой раз на нем фейлится, long'и использую. Edited by author 18.05.2014 18:13 Edited by author 18.05.2014 18:13 | Accepted Solution C++ / Any ideas on how to optimize it? | Haji | 1001. Reverse Root | 18 May 2014 11:40 | 2 | #include <stack> #include <cmath> using namespace std; int main() { double n; stack<double> numbers; while (scanf("%lf", &n) != EOF) numbers.push(n); while (!numbers.empty()) { printf ( "%.4f\n", sqrt( double(numbers.top()) ) ); numbers.pop(); } return 0; } Yep! Read and parse input manually, scanf is expensive, %lf is even more expensive. As a bonus, you would not have to store read doubles. What surprised me is that printf is even much more expensive, so if you can create text representation of a double in given format - you are welcome! I have just got 0.031s execution time, what is yours? | why am i wrong? on c++ | Cui Xiangfei | 1001. Reverse Root | 18 May 2014 10:02 | 2 | #include <iostream> #include <vector> #include <math.h> #include <stdio.h> using namespace std; int main() { vector<int> v; int value; while(true) { cin >> value; if(cin.eof()) { break; } else if(cin.fail()) { cin.clear(); // 清空错误状态 cin.ignore(); // 忽略掉下一个字符 continue; } else if(value >= 0) { v.push_back(value); } } cout << fixed; cout.precision(4); for(vector<int>::reverse_iterator iter = v.rbegin(); iter != v.rend(); ++iter) { if(*iter == 0) cout << (double)0 << endl; else cout << sqrt(*iter) << endl; } return 0; } Do not break on cin.eof(), it may be set even if a good value is read (in case the last line is not terminated by newline, I guess). Or maybe they terminate data by non-numeric symbols? Nobody would say :) Break on if (!cin), do not clear cin. And why do you check for (*iter==0)? It works fine as in general case. | anyone can tell me what's wrong? | mon | 1084. Goat in the Garden | 17 May 2014 17:54 | 6 | thanks... #include <stdio.h> #include <math.h> #define PI 3.1416 int main() { double a, r, area; scanf("%lf%lf", &a, &r); a /= 2; if (a >= r) { printf("%.3f\n", PI * r * r); return 0; } if (r >= sqrt(2) * a) { printf("%.3f\n", 4 * a * a); return 0; } printf("%.3f\n", PI * r * r - 4 * (acos(a / r) * r * r - a * sqrt(r * r - a * a))); return 0; } > thanks... > > #include <stdio.h> > #include <math.h> ?????? You can use integral to calculate the area Instead of using any mathematic function. I should use ".3lf" instead of ".3f" in the format string of printf. > I should use ".3lf" instead of ".3f" in the format string > of printf. #define PI 3.1416 // no #define PI 3.1415926535897932 //yes Better to use standard M_PI Edited by author 17.05.2014 17:54 | My AC program (do not see it if you want to think without help) | happylist | 1084. Goat in the Garden | 17 May 2014 17:51 | 3 | var a,r:integer; az,s,stru,b:real; function ArcCos ( X : Real ): Real; var tmpArcCos : Real; begin if X = 0.0 then tmpArcCos := Pi / 2.0 else tmpArcCos := ArcTan ( Sqrt ( 1 - X * X ) / X ); if X < 0.0 then tmpArcCos := Pi - tmpArcCos; ArcCos := 180*tmpArcCos/pi; end; begin readln(a,r); if a/2>=r then writeln(pi*r*r:1:3) else if sqrt(2)/2*a<=r then writeln(a*a) else begin az:=2*arccos((a/2)/r); s:=pi*r*r*az/360; b:=2*sqrt((r-a/2)*(r+a/2)); stru:=a/4*b; s:=s-stru; s:=pi*r*r-4*s; writeln(s:1:3); end; readln; end. Edited by author 17.05.2014 17:52 It is easy to put your code, where nothing is clear and say: "Look idiots, how clever I am". Try to help people, instead of showing off yourself. | WA #7 Why? | wolfpro | 1084. Goat in the Garden | 17 May 2014 17:44 | 2 | #include <iostream> #include <cmath> #include <stdio.h> int main() { using namespace std; int nRadius, nLenght; double dAnswer, dPi = 3.141592654; cin >> nLenght >> nRadius; if (nRadius * nRadius >= nLenght * nLenght / 2) { dAnswer = nLenght * nLenght; } else if (nRadius <= nLenght / 2) { dAnswer = nRadius * nRadius * dPi; } else { double dX = sqrt(nRadius * nRadius - nLenght * nLenght / 4); double dSg = dPi * nRadius * nRadius / 360 * (360 - 8 * atan2(dX, nLenght / 2) * 57.296); dAnswer = dSg + 4 * nLenght / 2 * dX; } printf("%0.3f", dAnswer); return 0; } Edited by author 31.08.2013 17:00 Edited by author 31.08.2013 17:00 Firstly calculate all in radians, don't even think about degrees, because all of cmath functions works in radians. And you should change all integers to double. Example: change 8 to 8.0 and so on. Use standart pi constant M_PI Check all functions. Edited by author 17.05.2014 17:45 | Опять тест 8 | baku | 1196. History Exam | 16 May 2014 22:31 | 2 | var a:array[1..15000] of longint; i,n,j,k,flag,b,m:longint; k1 :longint; begin k:=0; read(n); read(a[1]);k:=1; if n>1 then begin for i:=2 to n do begin read(b); flag:=0; j:=1; repeat if a[j]=b then begin flag:=1; end; j:=j+1; until (flag=1) or (j>k); if flag=0 then begin k:=k+1; a[k]:=b;end; end; end; read(m); for i:=1 to m do begin read(b); j:=1; flag:=0; repeat if a[j]=b then begin flag:=1; k1:=k1+1;end; j:=j+1; until (flag=1) or (j>n); end; writeln(k1); end. Тайм лимитед на 8 тесте. Что не так?? Где я что прохлопала.... Прохелпите мне, плиз Могу предположить, что программа выполняется слишком долго.У меня такая же штука: на сотые секунды больше выполняется | Accepted in JAVA | Adilbek_ | 1209. 1, 10, 100, 1000... | 16 May 2014 16:10 | 5 | Решение в лоб вряд ли пройдет. Мой алгоритм решения: 1. Легко заметить что сумма цифр от 1 до N может быть вычислена по формуле арифметической прогрессий. 2. Первая цифра всегда один. 3. Нужно найти самую меньшую или равную сумму к нашему К, её легко можно найти использую пункт 1. 4. Если найденная сумма минус К ровно одному то ответ один, иначе ноль. Edited by author 04.05.2012 21:02 Почему вы не можете объяснять внятно, такое ощущение что вы не сами решаете свои задачи! Объясните мне пожалуйста, Как вычислить сумму от 1 до N Если нам только известен an То есть место положения N, но не известен сам N. Ведь формула такова: Sn = a1+an/2*N; Как найти Sn Если нам не известно N ?????... Решение в лоб вряд ли пройдет. Мой алгоритм решения: 1. Легко заметить что сумма цифр от 1 до N может быть вычислена по формуле арифметической прогрессий. 2. Первая цифра всегда один. 3. Нужно найти самую меньшую или равную сумму к нашему К, её легко можно найти использую пункт 1. 4. Если найденная сумма минус К ровно одному то ответ один, иначе ноль. Edited by author 04.05.2012 21:02 Можно положить все возможные позиции в Set, а потом проверять есть ли эта позиция в Set'e. Как заполняется Set: Постепенно суммируем числа начиная от 0 и заканчивая суммой не больше 2^31-1, промежуточные суммы кладем в Set, прибавив перед этим единицу. Будьте внимательны при задании ограничения 2^31-1. Сперва я указал так: 1<<31-1 Но это неправильно, т.к. приоритет у вычитания, а потом у сдвига. Можно указать так (1<<31)-1 или еще проще Integer.MAX_VALUE (оба варианта равнозначны). Я решал задачу с Long, но достаточно и Integer. Edited by author 26.03.2014 01:14 package acm.timus.ru; import java.util.Scanner; public class N_1209 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int i=1,a=0,k=0; for (int j=1; j<=n; j++) { a=sc.nextInt(); if (i<a) { while(i<a){ k++; i+=k; } }else{ while(i>a){ i-=k; k--; } } if (i==a) { System.out.print("1"+" "); } else{System.out.print("0"+" ");}
} } } | I get AC with 0.109s 692k | onealwj | 1220. Stacks | 16 May 2014 13:36 | 2 | I use a block of continuous memory, divide the memory into Block(50 int).and each last one of Block is used to store the block number of previous Block in a same stack.moreover,I use two arrays to identify whether the Block is free and to store offset in a Block respectively.Finally, I use an array[1000] to store the number of Block are being used in a stack. Edited by author 16.05.2014 13:38 | No subject | mamur91 | 1925. British Scientists Save the World | 16 May 2014 11:50 | 1 | Please give me some tests for #Wa4 ! | To Admins | † SiriuS † [TWYT Union] | 1303. Minimal Coverage | 16 May 2014 11:28 | 2 | To Admins † SiriuS † [TWYT Union] 15 May 2014 23:52 Исправьте слово "соледует" в последнем предложении Результата: "соледует вывести единственную фразу «No solution»". | The problem was impossible to accept!!! | 黄源河 | 1325. Dirt | 15 May 2014 13:37 | 23 | How can you do it, I'am puzzled. Can you solve it today??? Edited by author 23.04.2004 11:29 Dijkstra via STL priority_queue<> ~0.25 sec Dijkstra via hand-written heap implemented with change_priority() function ~ 0.125 sec First. You can contract all regions in one vertex. Second. You can find shortest distance by regions. Third. Remove useless regions. BFS what was left. I don't agree your opinion.The method can't work out in time.This method I had used to solve,but fail. First. You can contract all regions in one vertex. Second. You can find shortest distance by regions. Third. Remove useless regions. BFS what was left. I don't agree your opinion.The method can't work out in time.This method I had used to solve,but fail. Why? I have impelemnted in O(N*M) --> AC in 0.359 s It's very nice method! I have got AC in 0.203s Try this test: 6 5 1 3 6 3 11111 12222 11112 12222 11112 22222 Correct answer: 7 1 So, after 1st BFS both components stay alive. What would prevent 2nd BFS from going a vertical line and output "6 1" while assumed path yields "6 5"? I'm sorry, but can anybody describe me 2nd BFS? I spent a lot of time trying, but it give me wrong answer on some tests. Now I know that's used colouration. Edited by author 29.04.2004 16:37 So fast !!!!!! I got TLE on test 16 all the time ........ I don't know what does "colouration" mean . Could you explain ? Could you say your way ? Oberon (Yura Znovyak) had told the method very clarity. So fast !!!!!! I got TLE on test 16 all the time ........ I don't know what does "colouration" mean . Could you explain ? Could you say your way ? Thanks . I just uesd 0.187s to get AC ! but i think it's possible that such condition appears: in the first BFS to find shortest distance by Changing Boots,there may be many ways to get the shortest Changes. but these ways are different in shortest way of Walking. So? I do not understand :( in the first BFS to find shortest distance by Changing Boots,there may be many ways to get the shortest Changes First BFS is for shortest distance by Changing Boots Then we throw away all useless regions and use SECOND BFS for shortest way of Walking Of course for each region we store min boot change to get to it. While finding shortest walking distance we almost ignore regions. Why almost: we make jumps only on regions with higher boot changes. So we can avoid saw-like regions. | I have WA#6 :( | Roma | 1345. HTML | 15 May 2014 00:06 | 1 | Please, help me. My code: #include <iostream> #include <cstring> #include <cctype> using namespace std; const int MaxSourceSize = 100000; const int MaxBuffSize = 1000; const int nKeyWord = 36; const char *comment_start = "<span class=comment>"; const char *keyword_start = "<span class=keyword>"; const char *string_start = "<span class=string>"; const char *number_start = "<span class=number>"; const char *end_teg = "</span>"; const char KeyWords[nKeyWord][sizeof( "implementation" )] = { "and", "array", "begin", "case", "class", "const", "div", "do", "else", "end", "for", "function", "if", "implementation", "interface", "mod", "not", "of", "or", "procedure", "program", "record", "repeat", "shl", "shr", "string", "then", "to", "type", "unit", "until", "uses", "var", "with", "while" }; int main() { register int i, j, g; char source[MaxSourceSize]; cin.get ( source, MaxSourceSize, 0 ); cin.ignore(); for ( i = 0; source[i]; i++ ) { if ( isalpha ( source[i] ) || source[i] == '_' ) { char buff[MaxBuffSize]; bool itKeyWord = false; for ( g = i, j = 0; isalnum ( source[g] ) || source[g] == '_'; g++, j++ ) buff[j] = tolower ( source[g] ); buff[j] = 0; for ( j = 0; j < nKeyWord; j++ ) if ( !strcmp ( buff, KeyWords[j] ) ) { itKeyWord = true; break; } if ( itKeyWord ) cout << keyword_start; for ( i; isalnum ( source[i] ) || source[i] == '_'; i++ ) cout << source[i]; i--; if ( itKeyWord ) cout << end_teg; } else { if ( isdigit ( source[i] ) ) { cout << number_start; for ( i; isdigit ( source[i] ) || ( source[i] == '.' && source[i+1] != '.' ); i++ ) cout << source[i]; i--; cout << end_teg; } else { switch ( source[i] ) { case '{': { int in = 0; cout << comment_start; for ( ; ; i++ ) { if ( source[i] == '{' ) in++; else if ( source[i] == '}' ) { in--; if ( !in ) {cout << source[i];break;} } cout << source[i]; } cout << end_teg; //i--; };break; case '\\': { if ( source[i+1] == '\\' ) { cout << comment_start; for ( i; source[i] != '\n'; i++ ) cout << source[i]; cout << end_teg; i--; } else { cout << '\\'; } };break; case '\'': { cout << string_start; cout << source[i++]; for ( i; source[i] != '\''; i++ ) cout << source[i]; cout << source[i]; cout << end_teg; };break; case '#': { cout << string_start; i++; cout << "#"; for ( i; isdigit ( source[i] ) || ( source[i] == '.' && isdigit ( source[i+1] ) ); i++ ) cout << source[i]; cout << end_teg; i--; };break; default: { cout << source[i]; };break; } } } } return NULL; } | Anybody get WA#10? | MAI.8 | 1482. Triangle Game | 14 May 2014 18:03 | 5 | I cann't understand why WA#10. Must I use long double? Please, give me some terrible tests. I got WA on test 10 too. And it's a little bit strange because the algo is simple. Maybe there are some problems with "10 fractional digits"... 0-result must be established in int64 only use 6 permutations for vertices of aim triangle also long double won't help because it's same type as double in VC++ As for 6 permutations, I think there must be only 3. Otherwise we'll consider flip-overs. I cann't understand why WA#10. Must I use long double? Please, give me some terrible tests. long double4 is normal. Use EPS = 0.00000001; if use EPS = 0.00000000001 then get WA11. |
|
|