Общий форум| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | | WA4 | d3m0n1c | 2001. Математики и ягоды | 12 дек 2013 00:26 | 3 | WA4 d3m0n1c 11 дек 2013 18:58 please give me a test for WA4. According to my current logic result should be (filled bucket weight - empty bucket weight) for each mathematician. Edited by author 11.12.2013 19:12 Re: WA4 Vladimir Shevchuk 12 дек 2013 00:01 Try this test: 7 5 9 3 4 8 Answer: 3 2 | | Please explain the test case | Shafaet | 1643. Атака Тёмной крепости | 11 дек 2013 22:26 | 3 | How can gelu's army reach the castle in 11 days?? | | output size??? | Igor Mihajlovic | 1453. Ферзь | 11 дек 2013 21:18 | 2 | what is the limit for output size it could be very big for n=10000 and s=100000 and if the coordinates is in center of hypercube then there is (s-1)*2^(n-1) by bishop and n*(s-1) by rock squares that queen can move how the hell should i output this?? or am i wrong??? plz help ASAP!!! Edited by author 21.08.2008 07:36 Edited by author 21.08.2008 07:36 you can use BigInteger class in java, which calculates the numbers of any sizes... | | WA_1:( guys, im trying to solve it for ages, please give me any advice... | BORODA | 1102. Странный диалог | 10 дек 2013 21:11 | 1 | I read 3 chars and run the follow DFA: one on in/out put lost: empty: in/out: input/output: put: here is my code: #include <iostream> #include <cstdio> #include <cassert> #include <cstdlib> #include <string> using namespace std; inline bool good(char C) { return (C >= 'a' && C <= 'z'); } int a[5][4] = {{0, 0, 0, 0}, {1, 0, 2, 4}, {1, 0, 2, 3}, {1, 1, 2, 4}, {0, 1, 0, 0}}; char c[3]; bool get_ans() { int n_u = 0, pos = 1; if (!good(c[2])) { return (c[0] == 'i' && c[1] == 'n'); } bool n2 = 0; while (true) { if (pos == 0) return 0; if (n2) return (pos != 0 && pos != 4); c[0] = c[n_u % 3]; for (int i = 3 - n_u; i < 3; i++) { c[i] = getc(stdin); if (!good(c[i])) { if (i == 0) return (pos != 0 && pos != 4); if (i == 1) return 0; n2 = 1; break; } } if (!n2 && c[0] == 'o' && c[1] == 'n' && c[2] == 'e') { pos = a[pos][0]; n_u = 3; continue; } if (c[0] == 'o' && c[1] == 'n') { pos = a[pos][1]; n_u = 2; continue; } if (!n2 && c[0] == 'o' && c[1] == 'u' && c[2] == 't') { pos = a[pos][2]; n_u = 3; continue; } if (c[0] == 'i' && c[1] == 'n') { pos = a[pos][2]; n_u = 2; continue; } if (!n2 && c[0] == 'p' && c[1] == 'u' && c[2] == 't') { pos = a[pos][3]; n_u = 3; continue; } return 0; } } int main() { // assert(freopen("inp.in", "r", stdin) != NULL); int n; assert(scanf("%d", &n) == 1); c[0] = getc(stdin); for (int i = 0; i < n; i++) { bool ok = 0; c[0] = getc(stdin); if (good(c[0])) { c[1] = getc(stdin); if (good(c[1])) { c[2] = getc(stdin); ok = get_ans(); } else { ok = 0; } } if (ok) printf("YES\n"); else printf("NO\n"); } } Edited by author 10.12.2013 21:13 Edited by author 10.12.2013 21:15 Edited by author 10.12.2013 21:22 | | If you have WA #4 | Smilodon_am [Obninsk INPE] | 1900. Машина счастья | 10 дек 2013 17:08 | 1 | If you have WA #4 try this simple test: 3 2 1 5 10 answer is of course 16 1 2 | | 12 test WA | Лерник Казарян [RAU] | 2011. Длинное условие | 10 дек 2013 12:48 | 3 | | | OH my god!!!!! Use vc++2010 or g++4.7.2 instead of G++4.7.2c++11 | Pegasus | 1915. Руины титанов: воссоздание былого | 10 дек 2013 08:17 | 3 | When I use G++11 I always get TLE,but once I try vc++2010 to submit my code , I got AC. I wasted too much time.Any can expalin it for me ? This is my code:#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> const int MAXN = 1000000 + 10; int a[2 * MAXN]; using namespace std; int main() { int n; scanf("%d", &n); int i = 1; while (n--) { int t; scanf("%d", &t); if (t > 0) a[i++] = t; else if (t == -1) printf("%d\n", a[--i]); else if (t == 0) { if (i - 1 <= n) { int num = min(i - 1, n); for (int j = 1; j <= num; ++j) { a[i] = a[i-num]; ++i; } } } } //system("pause"); return 0; } Edited by author 26.04.2013 15:20 MY LIFE WILL NEVER BE THE SAME! How does it works? could anybody explain it? Apparently, printf is painfully slow in C++11 for some reason. I was having the same issue while trying to submit problem #1976 (where answer consists of up to 1000000 integers) and ended up implementing manual output via putchar. Now i know a simple change of language would've worked as well. Edited by author 10.12.2013 08:17 | | Test #5 WA, Python | kitchent | 1020. Ниточка | 10 дек 2013 01:29 | 1 | The following is my code. First come a special case where n is 1. If n is not 1, more work should be done. First, the nails are sorted based on their x-coordination. The leftmost nail is accessed, and compared to the second leftmost nail. With some boundary case, all the nails can be sorted along the clockwise or counter-clockwise direction. Finally, I measure the distances between adjacent nails with pythagorean theorm. Together with 2*pi*r, which accounts for the round edges, should be the answer. What exactly does the code fail Test #5? import math def nail(n, r): return 2 * math.pi * r def pyth(a, b): return math.sqrt(a**2 + b**2) def perimeter(coord): ans = 0.0 for i in range(len(coord)): ans += pyth((coord[i][0] - coord[i-1][0]), (coord[i][1] - coord[i-1][1])) return ans if __name__ == "__main__": n, r = raw_input().split() n = int(n) r = float(r) coord = [] for each in range(n): i, j = raw_input().split() coord += [(float(i), float(j))] if n == 1: print "%.2f" % (2 * math.pi * r) else: coord.sort() directed_coord = [] directed_coord += [coord.pop(0)] if coord[0][1] > directed_coord[0][1]: clockwise = True directed_coord += [coord.pop(0)] else: clockwise = False directed_coord += [coord.pop(0)] if clockwise == True: for i in coord[:]: if i[1] > directed_coord[-1][1]: coord.remove(i) directed_coord += [i] for i in coord[:]: if i[1] >= coord[-1][1]: coord.remove(i) directed_coord += [i] coord.reverse() directed_coord += coord else: for i in coord[:]: if i[1] < directed_coord[-1][1]: coord.remove(i) directed_coord += [i] for i in coord[:]: if i[1] <= coord[-1][1]: coord.remove(i) directed_coord += [i] coord.reverse() directed_coord += coord ans = nail(n, r) + perimeter(directed_coord) print "%.2f" % ans | | WA1 Really! | VNXtreMe | 1446. Волшебная шляпа | 9 дек 2013 23:52 | 3 | This is one of the easiest problem in timus and I can't believe i'm getting WA1 for this problem. Im solving this problem using C++ and I'm using getline method from sstream to get the input. I'm storing the names in vectors and printing them with empty lines between the houses. I know Test 1 is usually the given data, but im getting WA1 even though I'm getting the same answer in my computer as given in the problem description. Does anyone know how to overcome this WA1 problem? Edited by author 03.01.2012 15:53 Ok so I found the problem, I know timus is piping the input and output via text files and the problem in that was that repeated getlines will fail. So I used the piping method as mentioned in timus and the problem was visible as it printed empty output to the output file. If you want to know how to pipe inputs and outputs follow the below link(look under Other notes section)- http://acm.timus.ru/help.aspx?topic=cppFor example : cin>>number; while(true){ getline(cin,input1); getline(cin,input2); if(somecondition) break; } However while(getline(cin,input)) {do} will work. But since we need 2 inputs the above code will fail as getline will return empty strings due to the reasons mentioned here- http://www.cplusplus.com/forum/articles/6046/ I overcame the problem using cin.ignore() just before entering the loop as to flush the input stream correctly and the corrected code of above may look like the code below- cin>>number; cin.ignore();//flushes input stream while(true){ getline(cin,input1); getline(cin,input2); if(somecondition) break; } If this didn't work then I suggest you to program in other languages. Edited by author 04.01.2012 10:41Thanks... great help indeed ... :) | | How do i wrote integers | Chitanda Eru | 1976. Оптимизация игры | 9 дек 2013 18:46 | 1 | My solution jumped from TL 19 to AC in under 0.3s when i replaced output via printf with writing each digit of a number via putchar. That just blew my mind. | | why got WA#43, some hints? PLZ ! | Heng | 1463. Радость населению! | 9 дек 2013 11:43 | 1 | Edited by author 09.12.2013 11:44 | | WA9 | Mamuka Sakhelashvili [Freeuni] | 1354. Палиндром. Он же палиндром | 9 дек 2013 01:44 | 1 | WA9 Mamuka Sakhelashvili [Freeuni] 9 дек 2013 01:44 Could you tell me what is test N9? | | AC 0.062 | TakeOver [MSU] | 1204. Идемпотенты | 8 дек 2013 03:19 | 1 | AC 0.062 TakeOver [MSU] 8 дек 2013 03:19 O(k*(sqrt(n)/log(n) + log(n))). hint: precalc primes table(so, we can factorize number using O(sqrt(N)/log(N)) operations). gl. | | I got WA on 23-th test!!! | Roibu Yulian | 1299. Псилонцы | 7 дек 2013 20:36 | 1 | Can somebody help me? I don't know what to do. I tried a lot of tests and all answers were correct. My code: #include<stdio.h> #include<conio.h> #include<math.h> #include<stdlib.h> #define max(a, b) ((a) > (b) ? (a) : (b)) #define min(a, b) ((a) < (b) ? (a) : (b)) int main() { long a, b, x, y, z, p, q; char ch; scanf("%d%d", &a, &b); scanf("%s", &ch); scanf("%d%d%d", &x, &y, &z); a=min(a, 100); if(ch=='A') scanf("%d%d", &p, &q); if(ch=='P') scanf("%d", &p); if(ch=='P') if(x>0) ch='D'; else { if((abs(p)>20)&&(abs(p)<160)){ if(((p>20)&&(p<=(90)))||((p<=-90)&&(p>-160))) printf("LEFT %d", a); else printf("RIGHT %d", a); } else if(abs(p)<=20) printf("FRONT %d", a); else printf("BACKWARD %d", a); } if(ch=='D') if((x>0)&&((x*20)>=b)) if(abs(z)<5) printf("FIRE %d", min(20, b)); else printf("BACKWARD %d", a); else ch='G'; if(ch=='G') { if(x==0) printf("STOP"); else { if(abs(z)<5) printf("FIRE %d", min(20, b)); if(z>=5) printf("LEFT %d", a); if(z<=-5) printf("RIGHT %d", a); } } if(ch=='A') if((p*q)>(3*(x*y))) if((x>0)&&(abs(z)<10)) printf("FIRE %d", min(20, b)); else printf("FRONT %d", a); else if((x>0)&&(abs(z)<5)) printf("FIRE %d", min(20, b)); else printf("BACKWARD %d", a); } | | WA6 | Oybek | 1607. Такси | 7 дек 2013 15:33 | 6 | WA6 Oybek 8 окт 2008 18:13 My code: why WA#6 import java.io.*; import java.util.*; public class misol1607 { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out);
int a = in.nextInt(); int b = in.nextInt(); int c = in.nextInt(); int d = in.nextInt(); int r=c; while (a<c) { if ((a+b)>=c) { r=c; break; } else { a=a+b; }
if (a>=(c-d)) { r=a; break; } else { c=c-d; } }
out.println(r);
out.flush(); } } 11 1 10 2 Edited by author 20.03.2010 17:26 Re: WA6 IgorKoval [PskovSU] 20 мар 2010 18:04 if(a==11 && b==1 && c==10 && d==2) cout<<11; Получается так: Садится в машину Петька и говорит:"11 руб" Таксист говорит: "Нет, брат, это слишком много для меня. Я подвезу тебя за 10 руб." Петька: "Послушай, товарищ, я настаиваю. Поехали за 11 руб." Таксист: "OK!" ИЛИ ЖЕ Получается так: Садится в машину Петька и говорит:"11 руб." Таксис радостно: "Поехали!!!!" И думает про себя:"Во дает! А я его бы и за 10 руб. подвез бы". Edited by author 20.03.2010 18:05 Edited by author 20.03.2010 18:05 | | Wrong answer, why???????? | Grigorij | 1001. Обратный корень | 7 дек 2013 13:29 | 2 | double h[131072],a,s; int main() { int i=0,j; freopen("input.txt", "rt", stdin); while(cin>>a){ h[i]=a; s=sqrt(a); h[i]=s; i++; } for(int j=(i-1);j>=0;j--){ cout<<setiosflags(ios::fixed)<<setprecision(4)<<h[j]<<endl; } return 0; } | | test #1 | AntiBug | 1650. Миллиардеры | 7 дек 2013 02:39 | 2 | Can anyone explain me test #1; London keeps 1st from day 12 to 21 (10 days) and 23 to 25 (3 days). Day 22th London = StPetersburg (=15b). Why output is London 14? Re: test #1 👨🏻💻 Spatarel Dan Constantin 7 дек 2013 02:39 The leaders are: 1- 1 London 2- 5 [tie] 6-10 Anadyr 11-11 Moscow 12-15 London 16-20 London 21-21 London 22-22 [tie] 23-25 London It seems you missed day 1. | | Sonmeone post the solution please :d | Furcoiu Ionut | 2001. Математики и ягоды | 7 дек 2013 01:14 | 3 | | | It AC! Funny solution | n0eR | 1295. Бред | 6 дек 2013 23:28 | 3 | uses SysUtils; var a : array[0..10000] of longint; n, m, i, x, y : longint; begin readln(n); if n = 1 then writeln(1) else if n mod 4 = 0 then writeln(0) else if (n mod 4 = 3) or (n = 25) or (n = 5) then writeln(2) else writeln(1); readln; end. i don't think it correct. how about 45 65 ? 85 ? 105 ? your code isn't always correct . you must use : if (n mod 4 = 1 and n mod 5 = 0) writeln(2) this is correct...
| | Some test for this problem | Adhambek | 1135. Новобранцы | 6 дек 2013 23:00 | 1 | 15 <>><<> <<><<< >>< answer is : 28. my program is accepted. |
|
|