| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| WA Test #3 | TwoFace | 1787. Поворот на МЕГУ | 4 дек 2016 16:17 | 2 |
import java.util.*; import java.io.*; public class MEGA { public static void main(String arg[]) { int k,n,i,sum=0; Scanner scan=new Scanner(System.in); k=scan.nextInt(); n=scan.nextInt(); int[] a=new int[n]; for(i=0;i<n;) { if(scan.hasNextInt()) { a[i]=scan.nextInt(); i++; } } for(i=0;i<n;i++) { sum+=a[i]-k; } if(sum<0) { System.out.println("1"); } else { System.out.println(""+sum); } } } This very simple program is turning out to be a headache. What is Test #3? inside cycle you need to check that (sum + a[i] - k) >=0 Edited by author 04.12.2016 16:18 Edited by author 04.12.2016 16:18 |
| Getting WA#2 | Anand Zutshi | 1042. Центральное отопление | 4 дек 2016 10:10 | 1 |
ll n; ll ar[300][300]; int main(){ cin >> n; for(ll i = 1; i <= n; i ++) for(ll j = 1; j <= n; j ++) ar[i][j] = 0; for(ll i = 1; i <= n; i ++){ while(1){ ll x; cin >> x; if(x == -1) break; ar[x][i] = 1; } } for(ll i = 1; i <= n; i ++) ar[i][n+1] = 1; ll col = 1; while(col <= n){ if(ar[col][col] == 1){ for(ll i = 1; i <= n; i ++){ if(i == col) continue; if(ar[i][col] == 1){ //choose ith row for(ll j = 1; j <= n+1; j ++) ar[i][j] = ar[i][j]^ar[col][j]; } } } else{ break; } col ++; } bool f = 1; ll br[300][300]; for(ll i = 1; i <= n; i ++) for(ll j = 1; j <= n; j ++) if(i==j) br[i][j] = 1; for(ll i = 1; i <= n; i ++){ for(ll j = 1; j <= n; j ++) if(ar[i][j]!=br[i][j]) f = 0; } if(!f) cout << "No solution" << endl; else{ for(ll i = 1; i <= n; i ++){ if(ar[i][n+1]==1) cout << i << " "; } } return 0; } I have used basic Gauss algorithm making the augmented matrix equal to an identity matrix. Still getting WA. Please help Thank you :) Edited by author 04.12.2016 10:11 |
| Something is grammaticaly incorrect in the problem description... | Georginsky | 1185. Wall | 4 дек 2016 05:14 | 2 |
"If the King finds that the Architect has used more resources to build the wall than it was absolutely necessary to satisfy those requirements, then the Architect will LOOSE his head." http://grammarist.com/usage/loose-lose/ |
| Incomplete Test Set | espr1t | 2103. Корпоративная почта | 3 дек 2016 18:42 | 1 |
I got AC with a wrong solution during the contest, so I think the test cases might be a bit weak. One example my wrong solution didn't pass is: 7 63713822 It printed 3, while the best answer is 2: 7 -> 8 -> 31856912 -> 31856911 -> 63713822. Can you please add it to the test-set? (Edit: I've fixed my solution now, but others may fail.) Edited by author 03.12.2016 18:42 |
| what is the 4 test ? | Bekzat | 1585. Пингвины | 3 дек 2016 08:28 | 1 |
my code #include <bits/stdc++.h> using namespace std; int main() { int n, c = 0, s = 0, v = 0, maxn = 0; cin >> n; string a, b; for(int i = 1; i <= n; i++){ cin >> a ; for(int i = 0; i <= a.size(); i++){ if(a[0] == 'E' && a[1] == 'm' && a[2] == 'p' && a[3] == 'e' ){ c++; break; } else if( a[0] == 'M' && a[1] == 'a' && a[2] == 'c' && a[3] == 'a'){ s++; break; } else if(a[0] == 'L' && a[1] == 'i ' && a[2] == 't' && a[3] == 't' ){ v++; break; } } cin >> b; } if(c > s && c > v){ cout << "Emperor Penguin"; } else if(s > c && s > v){ cout << "Macaroni Penguin"; } else if(v > c && v > s){ cout << "Little Penguin"; } return 0; } why incorrect |
| WA7 and WA10 | 💻Evgeny Nemtsev [UrFU]` | 1343. 12 месяцев | 3 дек 2016 03:02 | 1 |
WA7 3 000 -> 000000000002 WA10 0 -> 000000000002 |
| No subject | Yekaterina | 1293. Эния | 2 дек 2016 20:52 | 1 |
Program zadacha; Var a,b,c,n:integer; Begin Readln(n,a,b); c:=a*b*2*n; Write(c); End. |
| что не так? Help please!!! What's wrong? C++ | AndrewSultan | 1001. Обратный корень | 2 дек 2016 13:48 | 3 |
#include<stdio.h> #include<math.h> main() { float a,b,c,d; scanf("%f%f%f%f", &a,&b,&c,&d); printf("%6.4f\n%6.4f\n%6.4f\n%6.4f",sqrt(d), sqrt(c), sqrt(b), sqrt(a)); } Whats wrong? Edited by author 27.06.2016 15:47 Edited by author 27.06.2016 15:47 С чего ты взял что у тебя всего 4 числа? who tell u only 4 inputs? |
| For people, who have TLE. | Dima_Philippov | 1353. Миллиардная Функция Васи | 1 дек 2016 23:43 | 9 |
If you are using recursion function to calc the answer, then I suggest you to do it in one of some ways: 1) To write DP without using recursion. 2) To use array of memory and put there -1 if we calced the function of this parametres and 0 if not. 3) if you write in C++, inline may be will help you. If you have any questions, write. Edited by author 19.11.2010 01:08 :) Edited by author 19.11.2010 12:02 And me too - I want to see how to use recursion in this problem =))) goryinyich [dog] inbox [dot] ru Thank you!(otajanov_quvondiq@mail.ru.) Only for reading & outputting one integer? You can precalculate all the 81 values locally (it could take up 1 minute). Then use all the values to create static array: int ways[82] = { 0, 10, 45, 165, ..., 9, 1 }; int main() { int sum; cin >> sum; cout << ways[sum]; }
Edited by author 01.12.2016 23:44 |
| WA 10 | Baurzhan | 1752. Дерево 2 | 1 дек 2016 19:04 | 3 |
WA 10 Baurzhan 10 окт 2010 22:41 I'm searching the farest node for each node via one dfs and then try to answer the query using this information: 1) if(query_dist > distance_to_farest_node_from_query_vertex) output 0 2) if query_vertex is ancestor of it's farest node then i return go_up_from(farest_node_from_query_vertex, dist_to_far_node - query_dist) 3) if dist to lca(query_vertex,farest_node_from_query_vertex) enough (d(lca)>=query_dist) just go up from query_vertex in query_dist steps. 4) if(dist to lca is not enough) then go_up_from( farest_node, farest_node_dist - query_dist) my programm passes my tricky tests,sample test and test from thread. Pls, somebody, give me more tricky tests! Edited by author 10.10.2010 22:43 ok, ac now - i count LOG2N variable as floor(log2n) but i should set it ceil(log2n); Thanks! I was wondering why I got WA until I saw your reasons. It gave me spirit,now I have got deeper realization of this problem. Edited by author 01.12.2016 19:04 |
| what is wrong???? | dota2eexim | 1679. Башня дядюшки Скруджа | 1 дек 2016 18:47 | 1 |
|
| TM 8; Java Tips | Сиразеев Айдар | 1196. Экзамен по истории | 1 дек 2016 16:13 | 1 |
Now, if you have time limit, use Buffered Reader + Hashset. It is really works. Если вы столкнулись с Ограничением по времени, попробуйте использовать связку из Buffered Reader + Hashset. Оно реально работает!!!! Java 1.8.0 |
| ideas of improving perfomance | arrammis | 1507. Трудное решение | 1 дек 2016 04:02 | 2 |
I have AC at 0.14 sec, but I can see there are lot of faster solutions. So how did you optimize your solution so hard ?? hi, maybe the answer with powers from 2 to N+1 is always identical to given at this task(my AC is less than 0.14), also use some breaks like if (a[i][j] is already 1 then halt from cell computation etc.) send at night )) |
| Anyone have test 3 ? | hailoc12 | 1005. Куча камней | 30 ноя 2016 21:58 | 1 |
I don't know why I got TLE on test 3. I use bruteforce with Python. But in my PC, it runs so fast with n = 20 |
| I get confused.. | Shen Yang | 1840. Жертва рекламы | 30 ноя 2016 15:11 | 3 |
On test #22,we can extend two segments and get two valid circles,which circle do we choose ?? Maybe there are some error in my code... seems there can only be one circle.. Edited by author 30.11.2016 13:28 Spend one day for a typing error: alpha=atan2(y4-y3,x4-y3)+pi/2.; it's 作死 for Chinese |
| Any hint about test #3 ? | sanok | 1177. Сопоставление с шаблоном | 30 ноя 2016 12:59 | 2 |
Hi, My program pass all local tests but crashes after submit on test #3. Most probably I miss some boundary or weird pattern case. I use C++ and I took into account the fact that char's over 127 are converted to negative integers. Do you have any hint? UPD: My local test file: 31 '' like '%' '' like '' 'a' like 'a%' '·' like '·' 'f' like '[z-a]' 'a' like '[a-]' '·' like '[·a]' 'abcde' like 'a' 'abcde' like 'a%' 'abcde' like '%a' 'abcde' like 'b' 'abcde' like 'b%' 'abcde' like '%b' '25%' like '_5[%]' '_52' like '[_]5%' 'ab' like 'a[a-cdf]' 'ad' like 'a[a-cdf]' 'ab' like 'a[-acdf]' 'a-' like 'a[-acdf]' '[]' like '[[]]' '''''' like '_''' 'U' like '[^a-zA-Z0-9]' 'like' like 'like' ''' '' ' like ''' ''%' '[' like '[[]' '%' like '[%]' '_' like '[_]' ']' like ']' '^' like '^' 'like' like 'like' ''' '' ' like ''' ''%' |
| Accepted on the edge | Grandmaster | 1846. НОД 2010 | 29 ноя 2016 17:57 | 1 |
0.499 too close to comfort, i subitted first with GCC compiler got TLE than i submited with VC 2013 and got Accepted Edited by author 29.11.2016 18:01 |
| Help me find out the error. (Wrong Answer) | Ravi Kiran Kanneganti | 1000. A+B Problem | 29 ноя 2016 13:11 | 2 |
Java Program: import java.io.PrintWriter; import java.util.Scanner; public class Sum { public static void main ( String [] args ) { /** * Initialize */ Scanner inputs = null; PrintWriter output = null; try { if ( args != null && args.length == 2 ) { /** * Read Inputs */ inputs = new Scanner ( System.in ); /** * For Printing Output */ output = new PrintWriter ( System.out ); Integer a = inputs.nextInt (); Integer b = inputs.nextInt (); output.println ( a + b ); } else { System.out.println ( "Only 2 Integer values are accepted as input" ); } } catch ( Exception e ) { System.out.println ( "There is an error while executing this program : " + e ); } finally { if ( inputs != null ) inputs.close (); if ( output != null ) { output.flush (); output.close (); } } } } You don't really need to check for amount of arguments, you just need to read what you're asked for. Attempt to do this simplier, without try-catch-finally construction. |
| Why WA 9? | Zhuojie | 1745. Ещё Один Ответ | 28 ноя 2016 13:45 | 6 |
Try this: Test 1 input 1 ()) output 0 0 Test 2 input 1 () output 2 1 1 Test 3 input 2 () )( output 2 1 1 Test 4 input 2 () () output 4 2 1 2 Test 5 input 2 ((( ))))( output 0 0 I had WA 9 too, but now I have WA 11... I know, maybe you can try this. input (( )( )) output 6 3 1 2 3 I've WA #11 and my solution passes your tests. Maybe you know another interesting one? 6 )))((()(())(()()()())() )) (()(( (())( ()))(())( )))) Helped me to pass 9 Try following tests: 4 (( )( ) ))( 8 4 1 2 4 3 6 ((( ( )(( ))( )))(( ()) 14 4 1 5 4 6 |
| is X of the first touch equals 6.8182? | esbybb | 1258. Бильярд | 28 ноя 2016 04:39 | 1 |
|