| Show all threads Hide all threads Show all messages Hide all messages |
| WA#4, | MR_VLAD | 1233. Amusing Numbers | 29 Dec 2013 02:55 | 1 |
WA#4, MR_VLAD 29 Dec 2013 02:55 Well, I guess there is some sneaky thing. Someone can give me test 4 please. Thanks |
| java solution (very simple) | Rauf Agayev | 1118. Nontrivial Numbers | 29 Dec 2013 02:05 | 2 |
import java.util.Scanner; public class problem1197 { public static void main(String args[]) { Scanner in = new Scanner(System.in); int I = in.nextInt(); int J = in.nextInt(); if (I == 1) { System.out.println(1); return; } if (I == J) { System.out.println(I); return; } int deyer[] = new int[100001]; int idx = 0; int min = 10000; int mineded = 0; for (int i = J; i >= I; i--) { for (int j = i / 2; j >= 1; j--) { if (i % j == 0) { if (j < min) { min = j; mineded = i; if (j == 1) { System.out.println(i); return; } } break; } } } System.out.println(mineded); } } Very interesting idea but I can't guess why is it always true. Can you give me some explanation on my mail please?! mamuka_sakhelashvili@yahoo.com Thanks! |
| getting constant Memory Limit Exceeded | chang | 1306. Sequence Median | 28 Dec 2013 23:21 | 2 |
#include <bits/stdc++.h> using namespace std; typedef long long ill; ill arr[250000]; int main() { int n; cin >> n; for(int i = 0; i < n; ++i) cin >> arr[i]; nth_element(arr,arr+n/2,arr+n); double ans = (double)arr[(n/2)];
if (n & 1){ printf("%0.1lf\n",ans); } else { nth_element(arr,arr+(n/2)-1,arr+n); ans += (double)arr[(n/2)-1]; printf("%0.1lf\n",ans/2.0); } return 0; } Can somebody tell me the problem .... |
| Another solution | 146110Butorov | 1000. A+B Problem | 28 Dec 2013 19:22 | 1 |
var a,b,u:longint; begin readln(a,b); for u:=1 to b do inc(a); writeln(a); end. AC 0.015s 86k |
| WA10, ask for test case | invokerj | 1115. Ships | 28 Dec 2013 15:46 | 1 |
any good test case, thanks |
| A test may be help you get AC! | Arthas | 1684. Jack's Last Word | 28 Dec 2013 05:28 | 3 |
abcd aaaa The answer is obvious. Good luck! Thank you! This test is helpful for wa#5. Answer: No a a a a PS.: but for my program this answer is not obvious. =) Edited by Trolol 14.12.2011 15:49 Edited by author 14.12.2011 15:50 thanks a lot! wa5 is fixed |
| On Eclipse working perfect. Why WA? | yohoho | 1068. Sum | 28 Dec 2013 05:22 | 1 |
import java.util.Scanner; public class Test { public static void main(String[] args) {
Scanner in = new Scanner(System.in); float b = 0; float a = in.nextInt(); in.close(); if ( a >= 1) { b = ((a + 1) /2) * a;
System.out.println((int)b);}
else
{ b = ((-a + 1) /2) * -a; System.out.println((int)-b+1);} }} Edited by author 28.12.2013 05:22 |
| some explain about sample#1 & some test | hoan | 1628. White Streaks | 28 Dec 2013 03:41 | 3 |
this is a shape of sample#1: ('B'=Black, '.'=white) B...B .B... ..B.. you must count all the streak which not belong to the streak with size more than current streak, therefor the cell's (1,2) & (2,1) & (3,2) must'nt count because they are belong to streak (1,2)->(1,4) & (2,1)->(2,2) & (3,1)->(3,2). here some test for problem: ////////////////////////// input: 5 5 2 1 2 3 3 output: 12 ////////////////////////// input: 5 5 4 1 2 5 3 3 1 4 4 output: 12 ////////////////////////// input: 1 1 0 output: 1 ////////////////////////// input: 1 1 1 1 1 output: 0 ///////////////////////// input: 5 5 12 1 2 1 4 2 1 2 3 2 5 3 2 3 4 4 1 4 3 4 5 5 2 5 4 output: 13 ////////////////////////////// I hope can help you. GOOD LUCK! I don't understand this is a shape of sample#1: ('B'=Black, '.'=white) B...B .B... ..B.. I see 7 sreaks: 1) (2,1)->(3,1) 2) (3,1)->(3,2) 3) (1,2)->(1,4) 4) (2,3)->(2,5) 5) (1,4)->(3,4) 6) (3,4)->(3,5) 7) (2,5)->(3,5) why 8!? +(1,3)-->(2,3) i think... Edited by author 28.12.2013 04:11 Edited by author 28.12.2013 04:55 |
| How to make graph connected fast? | Andrew Sboev [USU] | 1709. Penguin-Avia | 27 Dec 2013 10:51 | 2 |
My method of making graph connected works nearly by O(N^2). Are there any classic algorithmes for such problem? You should use the system of disjoint sets. |
| Why it's wrong or how to solve this problem??? | K0T | 1709. Penguin-Avia | 27 Dec 2013 10:50 | 1 |
I have submit my solution, where I have used the system of disjoint sets. But it has WA 1 :)) What is another way to solve this problem??? |
| It accepted! | Jumbo | 1020. Rope | 27 Dec 2013 10:13 | 4 |
type t=record x,y:real; end; function dlina(x1,y1,x2,y2:real): real; begin dlina:=sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) ); end; var n,i:integer; x,y,p,cos,r:real; mas:array[1..103] of t; Begin readln(n,r); p:=0; for i:=1 to n do begin readln(mas[i].x,mas[i].y); if i>1 then p:=p+dlina(mas[i-1].x,mas[i-1].y,mas[i].x,mas[i].y); end; p:=p+dlina(mas[1].x,mas[1].y,mas[n].x,mas[n].y); p:=p+2*3.14159*r; writeln(p:1:2); end. jajaja good! I don't know this: 2*3.14159*r saves a lot of code! jajaja d*R - It means the length of circle |
| whats wrong???????? | yks | 1209. 1, 10, 100, 1000... | 27 Dec 2013 01:52 | 1 |
#include <stdio.h> int main() { long int k,a,n; scanf("%ld",&n); while(n--) { scanf("%ld",&k); a=1; while(k-a>0) k=k-(a++); if(k==1) printf("1\n"); else printf("0\n"); } } Edited by author 27.12.2013 01:54 |
| simple algo | dula | 1209. 1, 10, 100, 1000... | 27 Dec 2013 01:47 | 2 |
if((8*(input) - 7) -> integer) cout << 1; else cout << 0; wrong!!! check for input=3.....!!!!! if((8*(input) - 7) -> integer) cout << 1; else cout << 0; |
| test 6 | test210 | 1584. Pharaohs’ Secrets | 26 Dec 2013 21:28 | 1 |
test 6 test210 26 Dec 2013 21:28 help!I need the test data. |
| WHAT IS TEST #17 | Лерник Казарян [RAU] | 1821. Biathlon | 26 Dec 2013 19:20 | 1 |
|
| Why? | ZhuYuanchao | 1001. Reverse Root | 26 Dec 2013 18:13 | 1 |
Why? ZhuYuanchao 26 Dec 2013 18:13 For this problem,when I used G++,I got AC,but when I used GCC,I got WA so many times. Why? #include<stdio.h> #include<math.h> int main() { double b[3000000]; int n=0; double temp; while(scanf("%lf",&temp)!=EOF) b[n++]=sqrt(temp); for(int i=n-1;i>=0;i--) printf("%.4lf\n",b[i]); return 0; } Edited by author 26.12.2013 18:14 |
| How to use dynamic programming with bitmasking? | Nikunj Banka | 1326. Bottle Taps | 26 Dec 2013 00:01 | 3 |
Taking hints from the forum I am using dynamic programming with bitmasking. But I cannot understand how to memoize the results as the number of subproblems are very large. ie. 2^n * m that is 2^20 * 120. I am getting Memory limit exceeded. Is there a better way to define the states of the dp? Yes. You have the matrix dp[120][2^20]. There is only transitions from n-th to (n+1)-th row of the matrix. So, you need to memorize only 2 rows (previous and current) instead 120. There is solution with only 2^n memory (not 2 arrays, but just one) |
| Why this problem has so high complexity estimation? | breezemaster | 1280. Topological Sorting | 25 Dec 2013 23:59 | 2 |
It is very easy problem, i think complexity estimation 192 is overestimation. Very simple search was accepted: static bool Solve(IEnumerable<Tuple<int, int>> limitations, int[] proposedOrder) { foreach (Tuple<int, int> limitation in limitations) { int less = limitation.Item1; int greater = limitation.Item2; if (less == greater) return false; // wrong rule foreach (int currentSubj in proposedOrder) { if (currentSubj == greater) return false; // first is greater, so rule is contradicted if (currentSubj == less) break; // first is smaller, so rule is satisfied, go to next one } } return true; // all rules was satisfied } 1. Some time ago ML for it was 1MB. Try to solve within this limitation. 2. Average difficulty of a problem on Timus is ~1300, so 192 means that it is very simple problem (~15% of average difficulty), how did you get it is overestimation? |
| Why WA 2??? ALL FORUM TESTS ARE RIGHT ANSWER!!! | SergeyGlazkov | 1931. Excellent Team | 24 Dec 2013 23:29 | 1 |
program ytr; var n,i,p,d,t,min:longint; a:array[1..100000] of longint; b:boolean; begin readln(n); t:=-1; b:=true; p:=1; for i:=1 to n do begin read(a[i]); if b then begin min:=a[i]; b:=false; end; inc(t); if a[i]<min then begin p:=i-t; d:=t; t:=0; min:=a[i]; end; if (i=n) and (t>d) then p:=i-t; end; write(p); end. |
| How to solve this problem without sturctures | K0T | 1820. Ural Steaks | 24 Dec 2013 23:14 | 2 |
I have solved this problem using heap:) Please, give me advise, how to solve this problem without structures and etc. Oh my God.....i can't write 2*n / k + 1 (if 2*n%k==1) else 2*n / k Oh...I'm stupid deer |