Common Board| Show all threads Hide all threads Show all messages Hide all messages | | At last I solved this one!!!! | Tigran92[RAU] | 1306. Sequence Median | 25 Oct 2010 23:41 | 1 | | | WA7 | Paval Marius | 1742. Team building | 25 Oct 2010 18:01 | 1 | WA7 Paval Marius 25 Oct 2010 18:01 Can I have a sample input that would pass test 7? thanks | | 10 lines,got AC :D | hoan | 1011. Conductors | 25 Oct 2010 14:23 | 2 | #include <cstdio> void main (){ int res= 0, a1, a2; double p, q; scanf ("%lf%lf", &p, &q); do{ res ++,a1= (int)(p* (double)res)/100, a2= (int)(q* (double)res-(1e-7))/100; }while (a1== a2); printf ("%d\n", res); } Edited by author 25.10.2010 14:29 Edited by author 25.10.2010 14:29 | | Wrong Answer at test #1 | ReDAeR | 1001. Reverse Root | 25 Oct 2010 13:23 | 6 | .. Edited by author 13.05.2010 13:55 #include<stdio.h> #include<conio.h> #include<math.h> main() {float a,b,c,d,e,f,g,h; scanf("%f",&e); scanf("%f",&f); scanf("%f",&g); scanf("%f",&h); a=sqrt(e); b=sqrt(f); c=sqrt(g); d=sqrt(h); printf("%.4f\n",d); printf("%.4f\n",c); printf("%.4f\n",b); printf("%.4f\n",a); return 0; } You shold output results for each number of input meanings, not only for 4. Try using while () { } i got wrong answer inproblem 1001. But my input and output are ok. why? #include<stdio.h> #include<conio.h> #include<math.h> int main() {float a,b,c,d,e,t,g,h; scanf("%f",&e); scanf("%f",&t); scanf("%f",&g); scanf("%f",&h); a=sqrt(e); b=sqrt(t); c=sqrt(g); d=sqrt(h); printf("%.4f\n",d); printf("%.4f\n",c); printf("%.4f\n",b); printf("%.4f\n",a); return 0; } | | To Admins | Ibragim Atadjanov (Tashkent U of IT) | 1407. One-two, One-two | 25 Oct 2010 12:51 | 3 | To Admins Ibragim Atadjanov (Tashkent U of IT) 24 Oct 2010 15:19 something wrong with the 1st test or tests Following prog give me ans for all n (1..100) but at first test it gave me TL import java.math.BigInteger; import java.util.Scanner; public class Timus1407 { public static void main(String[] args){ Scanner input = new Scanner(System.in); int n = input.nextInt(); String s = "2"; BigInteger two = new BigInteger("2"); for (int i = 2; i <= n; i++) { BigInteger bigInteger = two.pow(i); String tmp = "1" + s; if(new BigInteger(tmp).mod(bigInteger) == BigInteger.ZERO){ s = tmp; } else{ s = "2" + s; if(new BigInteger(s).mod(bigInteger) != BigInteger.ZERO){ for(;;){} } } } System.out.print(s); } } Strange... On my computer it gives nothing except infinite running. You shouldn't compare BigInteger with "==". Use "compareTo" method. Strange but it is not tl in my computer. Its working still. | | Weak tests | Fyodor Menshikov | 1604. Country of Fools | 25 Oct 2010 12:34 | 3 | My AC solution for test 3 1 3 1 answers 2 1 2 2 3 while better answer is 2 1 2 3 2 | | Week Test Cases ... | wildCoder | 1774. Barber of the Army of Mages | 25 Oct 2010 12:16 | 6 | Hi ,.... A Greedy Algorithm Gets AC but it is Wrong ... for example for this Test Case The AC code says No 5 2 1 2 1 3 2 3 4 2 4 2 Hi I think it is better to add some more test cases to run out wrong algorithms insteat of this few tests that authors say. You are right. The problem will be investigated. Some anti-greedy tests were added. Problem was rejudged (submits from the online contest were not rejudged). We apologize to all authors who solved this problem using greedy algorithm and got wrong AC verdict because of weak tests. Why submits from online contest were not rejudged? I think, it's better to rejudge all submits. But final standings from online contest must not be changed. At current moment it is impossible (technically) to rejudge online contest without changing final standings. | | 2 admins : Minor typo in russian statement | 2rf | 1776. Anniversary Firework | 25 Oct 2010 02:39 | 2 | | | Weak tests | Sergey Lazarev (MSU Tashkent) | 1724. Origin of Man Clarified | 24 Oct 2010 21:48 | 6 | Weak tests Sergey Lazarev (MSU Tashkent) 31 Oct 2009 23:28 My AC program gives answer "1" to the test: GTACcAaa 1 1 8 I think so, as there is no "t" to pair with the "T" in the input string. Could you explain me how did you solve this one? My RMQ solution gives WA in test case 41. Why? My program is incorrect. It gives wrong answers on the test above and on many other tests. It's strange that I've got AC. But test 41 contains something like this: AGgTta 1 1 6 Right answer is "1". I aswered "i think so" trying to say that "your program is incorrect indeed". Sorry. Your code AC is strange for me too. BTW, really thanks for the test 41 tip. I finally got my AC. | | Test 10 | ★Perfez★ | 1542. Autocompletion | 24 Oct 2010 20:05 | 3 | If you print more than 10 lines per query you will get WA on this test. Edited by author 21.11.2010 17:40 | | Help ! WA on #6 (with three hours debuging , but still can find where it's wrong) | liuyang_elvis | 1171. Lost in Space | 24 Oct 2010 19:56 | 1 | #include <iostream> #include <cstring> #include <cstdio> using namespace std; const int INF = -(1<<30); int dp[2][260][4][4],cur,pre; unsigned int full_path[17][260][4][4]; int full_len[17][260][4][4]; bool can_down[17][4][4]; unsigned int path[17][4][4]; // record the path on each floor use bitset; int best[17][4][4]; //best[L][i][j] record the largest weighted of the paths from (i,j) whitch has a length of L; unsigned int sta; int len, wt; //length , state and weight; bool used[4][4]; int N; int w[17][4][4]; int des_r,des_c; int dy[4] = {-1, 1, 0, 0}, dx[4] = {0, 0, -1, 1}; char opp_dir[4] = {'S', 'N', 'E', 'W'}; int opp_dy[4] = {1, -1, 0 ,0}, opp_dx[4] = {0, 0, 1, -1}; /* * N(0) * W(2) E(3) * S(1) * because L less than 15; so it can be recorded as a 4 bits string which does'n exceed 4^15; */ inline bool isok(int r,int c){ return r >= 0 && r < 4 && c >= 0 && c < 4; } void search(int n, int r, int c){ wt += w[n][r][c]; used[r][c] = true; if(best[len][r][c] < wt ){ best[len][r][c] = wt; path[len][r][c] = sta; } int i; //printf("pre_state=%u\n",sta); //printf("len = %d\n",len); for(i = 0; i < 4; i++){ int ty = dy[i] + r, tx = dx[i] + c; if(isok(ty,tx) && (!used[ty][tx])){ sta = (sta<<2) + (unsigned int)i; len ++; search(n,ty,tx); sta >>= 2; len --; } } //printf("after_state = %u\n",sta); wt -= w[n][r][c]; used[r][c] = false; } void print_path(unsigned int p, int len){ if(len == 0){ return; } printf("%c",opp_dir[p%4]); print_path(p>>2,len-1); des_r += opp_dy[p%4]; des_c += opp_dx[p%4]; } int main() { freopen("in.txt","r",stdin); while(scanf("%d",&N) != EOF){ int t,i,j,k; for(i = N - 1; i >= 0; i--){ for(j = 0; j < 4; j++){ for(k = 0; k < 4; k++){ scanf("%d",&w[i][j][k]); } } for(j = 0; j < 4; j++){ for(k = 0; k < 4; k++){ scanf("%d",&t); can_down[i][j][k] = t ? true : false; } } } scanf("%d%d",&des_r,&des_c); des_r --; des_c --; cur = 0; int days; for(days = 0; days <= 16; days++){ if(days == 0){ fill_n(dp[cur][days][0], 16, 0); }else{ fill_n(dp[cur][days][0], 16, INF); } } fill_n(can_down[0][0], 16, true); fill_n(can_down[N][0], 16, false); can_down[N][des_r][des_c] = true; memset(used, false, sizeof(used)); for(i = 0; i < N; i++){ pre = cur; cur = pre ^ 1; for(days = 0; days <= 16 * (i + 1); days++){ fill_n(dp[cur][days][0], 16, INF); } for(j = 0; j < 4; j++){ for(k = 0; k < 4; k++){ if(can_down[i][j][k]){ for(len = 0; len < 16; len ++){ fill_n(best[len][0], 16, INF); } len = 0; sta = 0; wt = 0; search(i, j, k); } int m, n, pre_days; for(pre_days = i; pre_days <= i*16; pre_days++){ if(dp[pre][pre_days][j][k] >=0 ){ for(m = 0; m < 4; m++){ for(n = 0; n < 4; n++){ if(can_down[i+1][m][n]){ for(int inc_days = 0; inc_days <16; inc_days ++){ days = pre_days + inc_days + 1; if( best[inc_days][m][n] >= 0 && dp[cur][days][m][n] < dp[pre][pre_days][j][k] + best[inc_days][m][n]){ dp[cur][days][m][n] = dp[pre][pre_days][j][k] + best[inc_days][m][n]; full_path[i][days][m][n] = path[inc_days][m][n]; full_len[i][days][m][n] = inc_days; } } } } } } } } } } double res = 0; int ndays; for(days = N; days <= 16*N; days ++){ double tmp = (dp[cur][days][des_r][des_c]*1.0)/(days*1.0); if(tmp > res){ res = tmp; ndays = days; } } printf("%.4f\n",res); printf("%d\n",ndays-1); int flo = N-1; if(ndays == 1){ continue; } while(true){ len = full_len[flo][ndays][des_r][des_c]; unsigned int p = full_path[flo][ndays][des_r][des_c]; //printf("des_r=%d,des_c=%d\n",des_r,des_c); print_path(p,len); ndays -= len + 1; if(ndays <= 1){ printf("\n"); break; } printf("D"); flo --; } } return 0; } | | WA#11 and Why? | Zeva [USU] | 1418. Military Story | 24 Oct 2010 19:49 | 4 | And now WA#13 Baker's dozen! Edited by author 25.04.2006 19:43 I have found the silly mistake It's helped me: 23 0 8 1 2 2 1 2 3 2 4 2 5 2 6 3 1 3 2 3 3 3 4 3 5 3 7 4 1 4 2 4 4 4 6 5 1 5 3 5 5 6 2 6 4 7 3 2 I have WA 14 many times, because cos between two vectors(use floating operations) some times give wrong result. Solution accepted with EPS for comparation of cosinus = 1e-15. Edited by author 24.10.2010 19:50 | | Guy could you please give me some hint? | Vasiliy | 1658. Sum of Digits | 24 Oct 2010 19:29 | 1 | Or could you send me your code to investigate? kobchik83@list.ru | | Not trust! | svr | 1408. Polynomial Multiplication | 24 Oct 2010 14:44 | 4 | I do not trust that this problem can be solved during contest! Because it demand big amount of tehnical work such as grammar analysis, string manipulations and sorting. you're kidding right? I think it can be done in less than an hour, it's no big deal the parsing and string manipulation. Did you have some tests that failed you program? I think mine is ok, but WA9! A lot of time wasted to find a mistake... With no result. Maybe some tricky tests?... Edited by author 24.04.2007 23:29 Sure, for a competent programmer it is possible to hack it in an hour, but since it is for a school contest, I do not expect many teams to be able to solve it. Moderators, do we have the statistics the real contest it was taken from? | | Test 18 | bsu.mmf.team | 1768. Circular Strings | 24 Oct 2010 11:27 | 11 | Test 18 bsu.mmf.team 16 Apr 2010 00:01 What the fucking test is it? I failed on it many times, using every possible precision in calculations! I used Eps=1E-7 to compare two numbers and got Ac. I used it too... By the way, maybe my algo is wrong? I calculated the distances between i-th and (i+1)-th poitns and the distances between i-th and ((i+n/2) mod n)-th points if n is even or between i-th and a middle of segment, which is constructed by ((i+(n-1)/2) mod n)-th and ((i+(n+1)/2) mod n)-th points if n is odd. If these distances are equal, then "YES" Edited by author 17.04.2010 01:44 OK, what counter-test do you know then? :) what will be your answer if the polygon is not convex?? Oh! You are right, my program outputs "YES" on some special tests, but the answer should be always "NO"! Thank you! Now I've got AC. Simple algo with checking if points lie on a circumference and Point[i].x = x0 + R*cos(a0 + 2*k*PI/n), Point[i].y = y0 + R*sin(a0 + 2*k*PI/n) is true for sure. I just wanted to implement my "exotic" algo there :)))) But it was wrong... Edited by author 18.04.2010 12:11 I used your algo,but always wa4 ,why? I think that most Ac are by the chance, varing eps. If impossible to solve from the fist submission the problem is incorrect. I think right uderstanding the problem is following: Let P=<P1,...,Pn>-given n-polygon and r(P)=min(max dist(Pi-Qi),on all ideal n-polygons Q=<Q1,...,Qn>) if(r(P)<=1.e-5) YES else NO. That is optimization problem. P.S. I glad to say that under above consideration I got AC immidiately, while using chaotic eps-using had 12 WA 18. Edited by author 24.10.2010 12:41 | | wa7 please help | Ibragim Atadjanov (Tashkent U of IT) | 1403. Courier | 24 Oct 2010 07:47 | 1 | import java.util.Arrays; import java.util.Scanner; public class Timus1403 { /** * @param args */ public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); Order[] order = new Order[n]; int[] num = new int[100001]; int[] ans = new int[100001]; boolean[] used = new boolean[100001]; Arrays.fill(used, false); for (int i = 0; i < order.length; i++) { int d = input.nextInt(); int p = input.nextInt(); order[i] = new Order(i + 1, d, p); } for (int i = 0; i < num.length; i++) { num[i] = i; } Arrays.sort(order); int count = 0; for (int i = 0; i < order.length; i++) { int j = order[i].deadline; if(num[j] > 0 && !used[num[j]]){ count++; int x = num[j]; ans[num[j]] = order[i].index; used[num[j]] = true; num[num[j]] = num[j] - 1; if(x == j){ continue; } num[order[i].deadline]--;
} } System.out.println(count); for (int i = 0; i < used.length; i++) { if(used[i]){ System.out.print(ans[i] + " "); } }
} } class Order implements Comparable<Order>{ public int index; public int deadline; public int price;
public Order(int i, int d, int p){ index = i; deadline = d; price = p; }
@Override public String toString(){ String ret = ""; ret+= this.index + " " + this.deadline + " " + this.price; return ret; }
public int compareTo(Order other) { return -(this.price - other.price); }
} Edited by author 24.10.2010 08:20 | | very interesting!! there 2 code | Bobur | 1262. Pseudo-Roman Number | 23 Oct 2010 19:03 | 4 | var s : integer; ch : char; begin s := 0; while not eof do begin read(ch); case ch of '1', '5' : inc(s); '2', '4', '6', '9' : inc(s, 2); '3', '7' : inc(s, 3); '8' : inc(s, 4); end; end; writeLn(s); end. this ic gave me AC!! var s : integer; ch : char; a : array ['0'..'9'] of byte = (0, 1, 2, 3, 2, 1, 2, 3, 4, 2); begin s := 0; while not eof do begin read(ch); s := s + a[ch]; end; writeLn(s); end. and this WA#1!!!! i don't know why, who can explain it to me!! thanks!! i don't know what it mean in pascal, but in C it is "address to non-existent element of memory" take one correction: read(ch); //insert here: if ((ch<'0') or (ch>'9')) then break; s := s + a[ch]; ..... and sorry for my bad english Edited by author 08.12.2008 22:11 this is my program: const a:array['0'..'9'] of longint=(0,1,2,3,2,1,2,3,4,2); var k:char; s:longint; begin s:=0; while not EOln do begin read(k); inc(s,a[k]); end; write(s); end. use longint, not byte;) But can you tell me the reason using Longint excepted byte? thankx | | (help)i think my code is right,can you help me?(WA1) | Boqian Jiang | 1079. Maximum | 23 Oct 2010 18:20 | 3 | i think it will work out fine. But just got WA1. Can you help me ? thx! #include <cstdlib> #include <iostream> using namespace std;
int shu(int); int main(int argc, char *argv[]) { int a[10],b=0,max=0,d=0; while (cin>>a[b]) {if (a[b]==0) break; b++;} while (1) {if (a[d]==0) break; while (a[d]>=0) {if (shu(a[d])>max) max=shu(a[d]); a[d]--;} cout<<max<<endl; d++;}
system("PAUSE"); return EXIT_SUCCESS; }
int shu(int n) {int c; if (n==0) c=0; else if (n==1) c=1; else if (n%2==0) c=shu(n/2); else c=shu((n-1)/2)+shu((n-1)/2+1);} I have the same trouble whit you,WA1!!! But I test it myself whit my computer but find nothing wrong! | | Minimal step | KNU_Cyber | 1789. Searching for the Dodecahedron | 23 Oct 2010 17:39 | 2 | Does the algorithm must have the minimal numbers of steps? | | I ac | Ibragim Atadjanov (Tashkent U of IT) | 1791. Uncle Styopa and Buses | 23 Oct 2010 15:12 | 9 | I ac Ibragim Atadjanov (Tashkent U of IT) 20 Oct 2010 11:27 At first I got wa on test 12 19 ... After this test I got ac 6 1 10 1 10 1 6 1 10 1 10 6 3 2 3 1 3 2 Edited by author 20.10.2010 14:21 Is the ans YES? But I wa on 10... Greedy... Re: I ac Ibragim Atadjanov 22 Oct 2010 00:53 Edited by author 23.10.2010 03:27 That is also my way to greed I have done it but still wa Is there any tricks? Re: I ac Ibragim Atadjanov (Tashkent U of IT) 22 Oct 2010 12:04 give me your email. I'll send you my code(in java) f4f4f404 at 163.com Thanks! I've sent (-) Ibragim Atadjanov (Tashkent U of IT) 23 Oct 2010 02:24 Recieved. Thank you! I thought I misunderstood the problem's description... |
|
|