Общий форум1. 2 2 1 1 - YES This is such a sequence: (1;2) and (1;0) 2. 2 2 2 2 - NO This is impossible because number 2 is written only on one card (2;1) so it couldn't appear twice. Good luck! > 1. 2 2 1 1 - YES > This is such a sequence: > (1;2) and (1;0) > 2. 2 2 2 2 - NO > This is impossible because number 2 is written only on one card (2;1) > so it couldn't appear twice. > > Good luck! > please tell me how 2 2 1 1 can be YES.Because if Nick take cards for example that 0 1 reads 1 1 2 reads 1 2 3 reads 2 and he can't write 1 2 and 2 3 and answer must be NO i think Here the first two numbers are N and M This country doesn't exist anymore. There are 2 countries: Serbia and Montenegro. When I used this code: if (q == 0) { out.println(fullName); return; } if (set.add(name)) q--; I got WA 2. Then I replaced it by: set.add(name); if (set.size() > q) { out.println(fullName); return; } and got AC. So, can anybody explain me why? JavaDoc says: "Returns: true if this set did not already contain the specified element", or, in our problem, if this team is the first team of this university. Can you give me a test where my first solution gets WA, and the second gets AC? P.S. I got AC WITHOUT any comparing in lowercase! Edited by author 07.06.2010 14:12 The statement says: "If a university was presented by only one team, then its name may consists of the name of the university only" I missed this part at first and, consequently, got WA2. After fixing this got AC. Edited by author 07.06.2010 13:52 IF N=1 MY PROGRAM OUTPUT 0 0 ???????????????????? #include <cstdlib> #include <iostream> #include <string> #include <algorithm> using namespace std; int n,i,d,j; string s[505],e[505][90],w,w2,a1,a2; int main(int argc, char *argv[]) { cin>>n; for(i=0;i<n;i++) cin>>s[i]; string p; p=1; w=""; for(i=0;i<n;i++) { for(j=0;j<s[i].length();j++) if(s[i][j]=='\\') s[i][j]=1; } sort(s,s+n); for(i=0;i<n;i++) { d=0; for(j=0;j<s[i].length();j++) {w2=s[i][j]; if(w2.compare(p)==0) { d++; } else e[i][d]=e[i][d]+s[i][j]; } } for(j=0;j<80;j++) {if(e[0][j]!="") {for(d=0;d<j;d++) cout<<" "; cout<<e[0][j]<<endl;} else break; } for(i=1;i<n;i++) {a1=""; a2=""; for(j=0;j<80;j++) {a1=a1+e[i][j]; a2=a2+e[i-1][j]; if(e[i][j]=="") break; else if(a1!=a2) { a1=""; a2=""; a1=a1+e[i][j]; a2=a1+e[i-1][j]; for(d=0;d<j;d++) cout<<" "; cout<<e[i][j]<<endl;} } }
return 0; } I find your mistake.You used c++.You must use delphi.ok? 1,Don't care the K,ignore the K!=2. 2,two-way road. 3,the answer will be too long,so you should use long string. I have got many WA but I'don't know why .. I test my program and compare output test with CEOI1999 and have only one difference .. My find sometimes no the same path. not for example 23 54 56 34 but 56 34 23 54 ... this can be reason for WA? I was change my program and i get the same results that OUT in CEIO1999 test any one can help me same advise?. it's important the path.. in this problem you have to output the crossing points of the shortest sightseeing in the order how to pass them. for your example if the route is 23 54 56 34 it's wrong to output 56 34 23 54 because you jump from a crossing point to another even if there is no road between them.. check the output for the CEOI problem with this one and see if there is any difference.. I don't understand. If the input is: --------------------- 3 2 1 2 1 2 3 1 3 2 1 2 1 2 3 1 1 3 1 -1 --------------------- Isn't the output like this? --------------------- No solution. 3 1 2 --------------------- Help, please. Ok but if I have sightseeing :23 54 56 34 this is a cycle right? so 56 34 23 54 is the same cycle but it's only start from another point. I didn't try to sending solution from one month perhaps now i'll find source of problem :) WA1 - is important order path? - NO NO, the first vertex of cycle does not matter. My program prints sample out in such way: 2 5 3 1 And I got AC try to do test use this program: var fout:text; i:integer; begin assign(fout,'test1004.in'); rewrite(fout); writeln(fout,'100 101'); writeln(fout,'1 20 20'); for i:=1 to 99 do writeln(fout,i,' ',i+1,' 1'); writeln(fout,'100 1 1'); writeln(fout,-1) ; close(fout); end. It real help me. Thank you very much!!The answer is too long,I have to use ansistring in pascal. But unfortunately I was wrong agian. My program prints sample out: 3 5 2 1 No solution. And I got WA test 1 Edited by author 06.03.2009 21:37 Edited by author 10.06.2010 10:43 Edited by author 10.06.2010 10:43 I did it in java. it works just fine: 2975448 05:24:05 30 Mar 2010 ile 1047 Java Accepted 0.171 6 074 KB I read input using while (scanf("%d", &n) != EOF) { ... } to be able to run multiple tests. I had TLE 51 with such code. But when i deleted this cycle, i got accepted. Please check test 51. Test 51 is correct. You have got TLE 51 because of bug in your code. 1) the exponent may be very large (absolute value). e.g. -100000000000000000000000000000000000. 2) the exponent may pretend to be very large, but actually not. e.g. 000000000000000000000000000000000010 3) 12.e1 is not a valid floating point number, because the dot cannot be the last character of the integral part according to the grammar mentioned. good luck try also tests such as --1 1 I used conversion String to BigDecimal in Java. But cases 1 and 3 (in Koala's message) should be processed separately. To process very large negative exponent I used the following String res; try { res = bd.toPlainString(); } catch (OutOfMemoryError e) { // gets here if exp < -1000000 res = "0.0"; // no need to keep any digits if exp < -200 } But I don't like it. And maybe it's wrong? Nevertheless I still have WA 12 :))) Edited by author 02.06.2010 13:54 This test helped me. 4 Water 1 10 Cocoa-butter 0 Cocoa-powder 1 1 Lecithin 0 Answer is NO. Because there is a maximum of 40 parts of 10000 Edited by author 01.06.2010 16:05 I solve the system by the Gauss method, but the 16-th test he passes. Then I tried to take first the Gauss method and the results of the initial matrix method of Seidel (iterative algorithm), but it does not always converge and the result becomes invalid even before the 16-second test. What is there a problem? I've tried the heap one, I've done everything I could, but still TLE. I guess there should be some tricky part or my implementation error. what have you guys done to avoid the TLE? I use heap to arrange the time, everytime there is a new timestamp that is different from the last one, I check the heap and delete the out-of-time nodes. I also use a bool array to record the existance of a node, as well as a link table to record the next label that can be used. I don't know why I got TLE all the time... #include<stdio.h> #include<iostream> using namespace std; char s[10001],str[80]; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout); #endif int j = 0; memset(s,'\0',sizeof(s)); while(gets(s)) { int len = strlen(s); int i = 0; while(i<len) { if(s[i]=='>') { j++; if(j>79)j=0; } else if(s[i]=='<') { j--; if(j<=0)j=0; } else if(s[i]!='\n' && s[i]!='\0') { str[j] = s[i]; j++; } i++; } memset(s,'\0',sizeof(s)); } for(int i = 0;i<80;i++) printf("%c",str[i]); return 0; } "at the beginning the e-screen contains 80 spaces" I add in begin memset(str,' ',sizeof(80)); I get WA#1 to former =( Thank you!!!You help me!!!I got AC!!!=) New tests have been added. 91 authors have lost AC after rejudge. Thanks to Sergey Kopeliovich. you should find nearest prime number to J if the number doesnt exist you should find odd number because even number's divisor sum is bigger:) Edited by author 30.05.2010 18:53 Edited by author 30.05.2010 18:53 Edited by author 30.05.2010 18:54 var a,c,b : array[1..10000]of longint; var n : longint; procedure sort(m,t:longint); var y,i,j,w:longint; begin i:=m;j:=t;y:=a[(m+t)div 2]; repeat while a[i]<y do inc(i); while a[j]>y do dec(j); if i<=j then begin w:=a[i];a[i]:=a[j];a[j]:=w; inc(i);dec(j); end; until i>j; if i<t then sort(i,t); if m<j then sort(m,j); end; PRocedure red; var i,j : longint; begin readln(n); for i:=1 to n do read(a[i]); sort(1,n); end; {=-=================} PRocedure get; var i,sum1,sum2 : longint; begin sum1:=a[n]; sum2:=0; for i:=n-1 downto 1 do begin if sum1>=sum2 then begin sum2:=sum2+a[i]; end else begin sum1:=sum1+a[i]; end; end; writeln(abs(sum1-sum2)); end; {=-=================} BEgin red; get; end. Try brudforce =) It realy works What does brudforce mean,my english is poor Try brudforce =) It realy works Bruteforce REALLY works in 0.14, 130K:)) 2Aybek_TKTL: bruteforce in this case is full search through all possible variants (if u are Russian, then полный перебор). I have WA at #5 test too. |
|