|
|
Common BoardI had wa28 when in dfs-search visited each string ony once, but we must visit strings more than once if coming to this person post became shorter. So Dijkstra looks like is needed. I used many dfs call from v=1 until stabilization("seismic waves from v=1") I use bfs but I also get WA 28. You are using standard bfs, when once formed vertex skipped after, but in this problem we must do processing of each event of vertex echivement on subject of string length. This test help me to solv WA28 10 0000000000000000000000000 2 444444444444444444444444 777777 11111111111111111111111 3 55 777777 8888 22222222 3 11111111111111111111111 444444444444444444444444 8888 3333 1 444444444444444444444444 444444444444444444444444 3 2 55 8888 55 3 3333 444444444444444444444444 6 6 2 22222222 444444444444444444444444 777777 3 444444444444444444444444 6 55 8888 3 11111111111111111111111 22222222 777777 999999999999999999999999 2 444444444444444444444444 55 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX answer 9 0000000000000000000000000 22222222 3333 444444444444444444444444 55 6 777777 11111111111111111111111 8888 Please note that falicos's test is incorrect; the line "444444444444444444444444 3 2 55 8888" implies there is a user named "2", which is not specified by the input and hence illegal. If you remove the "3" from that line you get legally formatted input with the given answer correct. If you interpret the above test to mean there is a user named "2" with no followers, the answer would be 10 0000000000000000000000000 11111111111111111111111 2 22222222 3333 444444444444444444444444 55 6 777777 8888 i also got wa on 5 and then found out i considered room and floor both can be at most 100. but problem says floor is 100 and room can be at most 500. My answers are fully identical to the given one. But I have WA#1. Maybe, are there some format-specified features? Try this: 1 1 -1 ans: 1 3 Edited by author 05.09.2010 15:36 Edited by author 22.09.2012 19:16 Edited by author 22.09.2012 19:16 Thanks very much... It's really help me. Why are not correct 12 4 6 3 1 1 1) (())(())(()) =>3 2) (())(()))))(() =>0 3) )))(()(()))((( =>2 4) )))))((()))))((((((( =>1 5) )()()()()()()()(())( =>9 6) ))(()( =>1 I get WA 13 again and again and I can not find a mistake. My main logic looks like this: for(j=0;j<n;j++) {l=(x[j]-X)*(x[j]-X)+(y[j]-Y)*(y[j]-Y)+(z[j]-Z)*(z[j]-Z); if (l-D<1e-10) D=l;} printf("%0.6f\n",acos((2-D)/2.0)*r); I believe it is correct..So can anybody help me with finding a bug, please? Does anyone have a same problem? I had exactly this kind of problem. WA13. then I wrote: double tmp= (2 - minL)/2.0; tmp-=0.00000000001; if (tmp<-1) tmp=-1; return r*Math.acos(tmp); and AC. It is problem with precision, of course. Please, somebody, give the 4th test What an amusing problem! Now it seems to be easy - in contrast to prima facie :^) Special thanks to Vorokh Sergey and Mamonov Anton, who proved correctness of my solution. And some test data input #1: 0 0 90 5 5 4.9 output #1: 28.2176 input #2: 0 0 90 5 0 -0.000001 output #2: 31.4159 Can you explain the answer to the input#1? I can't understand why. Can anybody help me? Try these two tests: 5 10 -5 3 -1 15 ---- 5 15 -1 3 -5 10 In both right answer is 22. try this: aaaba is 2 aa aba not 3 aaa b a WA #7 can anyone help plz? using simple dp you are probably considering to get rid of palindromes as early as possible for example, consider the case "aabba" if you say it is 3 palindromes: "aa", "bb", and "a", then you are wrong, since it can be "a" and "abba" var AD,AC,BD,BC,X,Y:int64; CD:real;
BEGIN read(AD,AC,BD,BC);
X:=AD*AC-BD*BC; Y:=AD*AC*(BD*BD+BC*BC)-BD*BC*(AD*AD+AC*AC); if(X=0)or(Y*X<0) then write('Impossible.') else begin write('Distance is '); CD:=1000*sqrt(Y/X); write(CD:0:0,' km.'); end; END. Why Wa18? What is test? I think fraction part. AC got q:=q*100000; q_int:=round(q) div 100; BUT WA 34 got q:=q*100000; q_int:=trunc(q) div 100; and q:=q*10000; q_int:=trunc(q) div 10; Here is test: 2 0.1 0 -1.9 0 ---------- 2 0.100000 Why Runtime Error? #include <cstdio> #include <vector> #include <algorithm> using namespace std; int main() { unsigned short n, m; scanf("%hu", &n); vector <unsigned long long> bytes(n); vector <vector<unsigned short> > red(n); for(unsigned short i=0;i<n;i++) scanf("%llu", &bytes[i]); for(unsigned short i=1;i<n;i++) { unsigned short x, y; scanf("%hu %hu", &x, &y); red[x-1].push_back(y); red[y-1].push_back(x); } if(n>1) { for(unsigned short i=0;i<red.size();i++) sort(red[i].begin(), red[i].end()); for(unsigned short i=0;i<red.size();i++) { for(unsigned short j=0;j<red[i].size()-1;j++) { if(red[i][j]==red[i][j+1]) { for(unsigned short pos=j+1;pos<red[i].size()-1;pos++) red[i][pos] = red[i][pos+1]; red[i].pop_back(); } } } } scanf("%hu", &m); for(int i=0;i<m;i++) { unsigned short v, t; scanf("%hu %hu", &t, &v); if(t==1) { for(unsigned j=0;j<red[v-1].size();j++) bytes[red[v-1][j]-1] += bytes[v-1]; } if(t==2) printf("%llu\n", bytes[v-1]%1000000007); } } I use a simple DP ,but WA#10.Give me some useful tests,pls. And I'd like to know if there is a better algo. Recursive solution works fine! If you are getting TLE, Rethink your DP state :) |
|
|