| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| Grammar clarifications | Denis Koshman | 1345. HTML | 11 ноя 2009 16:20 | 3 |
Got AC 0.001 sec from the first effort :) I saw many requests for clarification here, but it's easier to describe grammar in terms of behavior. Go sequentially through input data. 1. If you meet '{' - everything until closest corresponding '}' is a single comment, no matter what's inside. '}' corresponds to '{' if all {,} characters between them form valid bracket sequence. 2. If you meet '//' - everything until '\n' is a single comment, no matter what's inside. 3. If you meet ' - everything until next ' is a string, no matter what's inside. 3. If you meet '#' followed by a digit - everything until first non-digit is a string. 4. If you meet a digit, then everything until first non-digit is a number. If first non-digit character is '.' AND it is followed by another digit, then this post-dot digit sequence is appended to the number as well as the dot itself. I.e. "1.23" is a single number, but "123.a" is number '123' followed by '.', followed by identifier 'a'. 5. If you meet underscore or letter, everything until first non-digit-non-underscore-non-letter is an identifier. It may be a keyword. 6. Output all other characters as is. Edited by author 17.08.2008 01:02 These statements should be stated in problem description. They are all right and to recreate them I tried 50 submissions. In western sytes it is a rule punctual and clear descriptions all conditions but in our country often used believeness in super talantedness of us. Edited by author 10.01.2009 20:26 Really helpful! Link to this post should be added to the statement :-) |
| Bug in russian statement | Oracle[Lviv NU] | 1345. HTML | 11 ноя 2009 16:16 | 1 |
<PRE> and a line </PRE> replace "and a line" with it's translation (и строку) :-) |
| Please help!!!! | 902 group (RAU) | 1021. Таинство суммы | 10 ноя 2009 21:53 | 2 |
Please help!!!Tell me what is wrong in my algo???Help to orgonise input!Here is my code: #include <iostream.h> int main() { const int N=50000; int x[N],y[N]; bool s; int i,k; int a,b; cin>>a; for(i=0;i<a;i++) { cin>>x[i]; } cin>>b; for(i=0;i<b;i++) { cin>>y[i]; } for(i=0;i<a;i++) { for(k=0;k<b;k++) { if(x[i]+y[k]==10000) { s=true; } if(x[i]+y[i]!=10000) { s=false; } } } if(s=true) { cout<<"YES"<<endl; } if(s=false) { cout<<"NO"<<endl; } return 0; } You must finish your iterations and print "YES", if an appropriate pair of numbers is found. Now your program outputs the value of the 's' for the last pair, x[a-1] and y[b-1]. But this algo can be substantially optimized. |
| WA#6 | VorobeY1326 | 1023. Пуговицы | 10 ноя 2009 19:51 | 1 |
WA#6 VorobeY1326 10 ноя 2009 19:51 Help somebody!! Why my code has WA6..or GIVE SOME TESTS, please)) #include<iostream> #include<vector> #include<cmath> using namespace std; vector<int>easy_numbers(0); int next_number(int numb_of_numb) { int step=easy_numbers.size()-1; int curr_number=easy_numbers[step]; while(step+1<numb_of_numb) { while(1) { curr_number++; int sq_root=sqrt(static_cast<double>(curr_number))+1; int buf_step; buf_step=0; while(easy_numbers[buf_step]<sq_root) if (curr_number%easy_numbers[buf_step++]!=0) continue; else goto g1; break; g1: } easy_numbers.push_back(curr_number); step++; } return curr_number; } int main() { int K; int L=-1; cin >> K; if (K==4) {cout << 3; exit(0);} easy_numbers.push_back(3); int buf=0; while((easy_numbers[buf]*easy_numbers[buf])<=K) next_number(++buf); for (int i=0;i<easy_numbers.size();i++) { if (K%easy_numbers[i]==0) {L=easy_numbers[i]-1; break;}
} if (L==-1 && K%2==0) {L=K/2-1; cout << L; exit(0);} if (L==-1) {L=K-1; cout << L; exit(0);} cout << L; return 0; } |
| Weak tests | Fyodor Menshikov | 1297. Палиндромы | 10 ноя 2009 14:04 | 4 |
Please add test aa I know AC solution that answers to this test 'a'. why right answer 'a' and not 'aa'? |
| I know how to do it now! | Зане | 1627. Join | 10 ноя 2009 12:58 | 1 |
We can use Matrix-Tree theoremd(生成树计数) to solve it! O(N^3) |
| !!! use "seekeof" instead of "eof" | cqyzzzl | 1001. Обратный корень | 10 ноя 2009 12:38 | 1 |
have a try. { while not seekeof begin end; } |
| Does the order in which you print the word matters? | Prabhjot Singh | 1002. Телефонные номера | 10 ноя 2009 02:35 | 2 |
Does the order in which you print the word matters? |
| Help me with 5th test. | Basmus | 1200. Рога и копыта | 10 ноя 2009 00:19 | 5 |
I cannot pass thru 5th test. Edited by author 06.10.2004 20:05 TEST #5 Vlad Veselov [PMG17, Vinnitsa - KNU, Kiev] 6 окт 2004 20:05 input--> 5434.87 -4567 300 correct output--> 1540461.00 300 0 Re: TEST #5 Иксанов Семён Александрович 8 окт 2004 18:10 where do you get an input tests? |
| About Test #11 | PPLoveTT | 1315. ПДВАС и ПВИПАС | 9 ноя 2009 21:36 | 3 |
What's the trick on Test #11?.. Help me ... I also need some help... It seems to me, that my program is correct. Got AC finally. In 11 test N=1000; M=1000; D=1998; X=1000; Y=1; Rescue operation required; start position in water. My mistake was, that I didn't fill with water start position of bfs. |
| I don't know why I got ac. | 衣衣是我的全部,我爱衣衣 | 1226. йынтарбО кодяроп | 9 ноя 2009 19:20 | 5 |
I have writen the program if many similar ways. I don't know why I got ac with this program: const u : set of char = ['A'..'Z','a'..'z']; var s : string; i : integer; ch : char; begin s := ''; while not (eof) do begin read(ch); if ch in u then s := ch+s else begin write(s); write(ch); s := ''; end; end; if ch in u then write(s); end. by the way, the pascal program should use "read(char)" instead "readln(string)" or you will get crash! Yeah, I don't know, either. I think it sure will be WA. may be all the words are palindromes:) All right. Because s +'abc' will give "sabc", and 'abc' + s will give "abcs". |
| connected iff sharing point | Koala | 1281. River Basin | 9 ноя 2009 10:22 | 1 |
two rivers are considered to be connected iff they share at least one vertex (no matter inner vertex or end vertex) example 1: 2 2 -1 0 1 0 2 0 1 0 -1 not connected, because their intersection (0, 0) is not a vertex of river 1 or river 2 example 2: 2 2 -1 0 1 0 3 0 1 0 0 0 -1 not connected, because (0, 0) is not a vertex of River 1 example 3: 2 3 0 1 0 0 0 -1 3 -1 0 0 0 1 0 connected, because (0, 0) appears on both rivers |
| Tricks are! | svr | 1730. Челмедведосвин | 9 ноя 2009 09:04 | 3 |
After 3 test use a/b=>(a/nod(a,b))/(b/nod(a,b)) To the English reader it will be not clear. It is necessary to write GCD. |
| Two dimensional interval tree | typedef | | 9 ноя 2009 05:24 | 3 |
Hello. I have an array of numbers from 1 to N. The order is random. I have to answer a lot(M) of questions like: how many numbers from interval [x, y] bigger than k. I tried to build two-dimensional interval tree: each edge of interval tree has an internal tree. But that tree was too large. 1 <= N, M <= 100000 Memory limit = 64 Mb Also I tried to build Fenwick tree. But it also needs too much memory: O(N^2). Please, can you help me to compress an interval tree or Fenwick tree? Or, maybe, there is another way to solve this problem? Thank you. You can store in each node of interval tree sorted list of numbers in corresponding interval. It requires O(n log n) memory and can be built in O(n log n) time (you can merge two sorted lists in linear time). With this tree you can answer queries in O(log^2 n) time using binary search Edited by author 10.11.2009 02:42 Thank you! It really works :) |
| WA 18 | Sergiy_PMI_31 [Lviv NU] | 1730. Челмедведосвин | 9 ноя 2009 03:52 | 1 |
WA 18 Sergiy_PMI_31 [Lviv NU] 9 ноя 2009 03:52 I still have WA on test 18 after many efforts. Does anyone know some tricks about this test? My program gives right answers on all my tests. Can anyone give me more tests? |
| Sample | Oracle[Lviv NU] | 1308. Пирамида декана | 9 ноя 2009 02:14 | 1 |
Sample Oracle[Lviv NU] 9 ноя 2009 02:14 Shouldn't the answer to the sample be 0.3660? I've solved this problem assuming, that pyramid lies on triangular edge. It seems to me that it is wrong suggestion, nevertheless it got AC. It seems to me, that pyramid should be firstly rotated to lay on one of the triangular face - then the answer is 0.3660. Am I wrong? Edited by author 09.11.2009 02:17 |
| who can tell me how many integer numbers shoud I input each time? | hengxin | 1001. Обратный корень | 9 ноя 2009 01:47 | 5 |
from the statements of the problem ,I don't know how to end my input .Is there anyone can help me? Thank you very much Edited by author 13.01.2009 17:38 I really don't know how to end my input file... Should I write while not eof do??? If you data type is double or float or something like that, to end the input you can simply type a letter (a-z , A-Z).But bare in mind that in the example input there is no such letter so I don't have a clue how to end it according ot the judge criteria. :P :D |
| Just to make shure I understood right ^_^ | Fokysnik | 1017. Лестницы | 9 ноя 2009 01:21 | 4 |
N=5 Q=2 N=6 Q=3 N=7 Q=4 N=8 Q=5 N=11 Q=11 N=17 Q=36 Right? Wrong: N=17 Q=36 Right: N=17 Q=37 kuso! >_____<" Edited by author 09.11.2009 01:23 |
| Why dose my program get WC? | mikegreen7892003 | 1149. Танцы синуса | 8 ноя 2009 23:35 | 3 |
var n:byte; procedure a(now,step:byte); begin if now=step then write('sin(',now,')') else begin write('sin(',now); if now mod 2=1 then write('-') else write('+'); a(now+1,step); write(')'); end; end; procedure s(step:byte); begin if step=1 then begin write('('); a(1,step); write('+',n-step+1,')'); end else begin if step<>n then write('('); s(step-1); a(1,step); write('+',n-step+1); if step<>n then write(')'); end; end; begin readln(n); s(n); writeln; end. var n:byte; procedure a(now,step:byte); begin if now=step then write('sin(',now,')') else begin write('sin(',now); if now mod 2=1 then write('-') else write('+'); a(now+1,step); write(')'); end; end; procedure s(step:byte); begin if step=1 then begin if step<>n then write('('); a(1,step); write('+',n-step+1); if step<>n then write(')'); end else begin if step<>n then write('('); s(step-1); a(1,step); write('+',n-step+1); if step<>n then write(')'); end; end; begin readln(n); s(n); writeln; end. in 5 out ((((sin(1)+5)sin(1-sin(2))+4)sin(1-sin(2+sin(3)))+3)sin(1-sin(2+sin(3-sin(4))))+2)sin(1-sin(2+sin(3-sin(4+sin(5)))))+1 Edited by author 08.11.2009 23:59 |
| 1021 wrong answer | GulfStream | 1021. Таинство суммы | 8 ноя 2009 21:23 | 3 |
Somebody can respond why incorrectly? On turbo pascal all tests passes. var a:array[1..1000] of integer; b:array[1..1000] of integer; i,j,n,m,r: integer; s1,s2,s: string; begin read(n); for i:=1 to n do readln(a[i]); for i:=1 to n-1 do if a[i]>a[i+1] then begin r:=a[i]; a[i]:=a[i+1]; a[i+1]:=r; end; read(m); for j:=1 to m do readln(b[j]); for j:=1 to m-1 do if a[j]<a[j+1] then begin r:=a[j+1]; a[j+1]:=a[j]; a[j]:=r; end; for i:=1 to n do for j:=1 to m do begin if ((a[i]+b[j])=10000)and((a[i]+b[j])<>10000) then s:='yes' else if (a[i]+b[j])=10000 then s1:='yes' else if (a[i]+b[j])<>10000 then s2:='no'; end; if s='yes' then writeln(s) else if s1='yes' then writeln(s1) else if s2='no' then writeln(s2); end. Edited by author 08.11.2009 20:44 You should output capital letters ("YES", "NO"). Time limit exceeded How to correct?=) How time depends? Edited by author 08.11.2009 21:27 |