| Show all threads Hide all threads Show all messages Hide all messages |
| compilation error | huiqi xu | 1078. Segments | 25 Apr 2007 00:01 | 4 |
why did i get compilation error? here is my program: <#include<iostream> using namespace std; #define N 500 int num; int denote[N],c[N],len[N]; int length; void quick_sort(int st[N][2],int low,int high,int pi); void print() { int mem[N][2]; int k=1; for(int i=1;i<=num;i++) if(c[i]==1) { mem[k][0]=len[i]; mem[k][1]=i; k++; } quick_sort(mem,1,k-1,1); if(k==1) cout<<1<<endl; else { for(i=1;i<=k-1;i++) cout<<mem[i][1]<<' '; cout<<endl; } } void quick_sort(int st[N][2],int low,int high,int pi) { int head=low,tail=high; st[0][0]=st[pi][0]; st[0][1]=st[pi][1]; if(low>=high) ; else { while(low<high) { while(low<high&&st[high][0]>=st[0][0]) high--; st[low][0]=st[high][0]; st[low][1]=st[high][1]; while(low<high&&st[low][0]<st[0][0]) low++; st[high][0]=st[low][0]; st[high][1]=st[low][1]; } st[low][0]=st[0][0]; st[low][1]=st[0][1]; quick_sort(st,head,low-1,head); quick_sort(st,high+1,tail,high+1); } } int main() { int lp[N][2],rp[N]; int i,j,k=1; cin>>num; for(i=1;i<=num;i++) { cin>>lp[i][0]>>rp[i]; len[i]=rp[i]-lp[i][0]; lp[i][1]=i; } memset(c,0,sizeof(c)); quick_sort(lp,1,num,1); length=1; denote[num]=1; for(i=num-1;i>0;i--) { denote[i]=1; for(j=i+1;j<=num;j++) { if(lp[i][0]!=lp[j][0]) if(rp[lp[i][1]]>rp[lp[j][1]]) if(denote[i]<denote[j]+1) { denote[i]=denote[j]+1; if(length<denote[i]) { c[lp[i][1]]=1; if(length==1) c[lp[j][1]]=1; length=denote[i]; } } } } cout<<length<<endl; print(); return 0; } Edited by author 24.04.2007 11:29 First write #include <iostream> instead of <#include <iosteream> Second declar indentifier i in for(int i=1;i<=num;i++) { ... } instead of for(i=1;i<=num;i++) { ... } the first you mentioned is my mistaken writing when i am editing.the second is the reason i get CE.thank you so much. |
| Help me ! What is test 10 ?? | FireHeart | 1083. Factorials!!! | 24 Apr 2007 22:30 | 2 |
Please tell me test 10 and its answer !! Thanks ! Sorry,i can't give you test 10,but I can give you my AC program,if you want!!! Edited by author 24.04.2007 22:31 |
| What is test 12? I always get WA on it! | IGOR_Lviv NU | 1542. Autocompletion | 24 Apr 2007 20:32 | 3 |
try 20 words with like a****** with the same freqency or try this test 3 asd bfs dfs 2 d d My progarm works nice on this test, but I have WA. Can someone give me more tests? Pls... |
| TEST 10! Or any OTHER! | CF# /*Anoshin,Sotov,Khuramshin*/ | 1543. Dance Revolution | 24 Apr 2007 19:06 | 1 |
Why can I get WA10, what are the special tests can be for this problem? Edited by author 24.04.2007 19:07 |
| No subject | PPaavveell | 1404. Easy to Hack! | 24 Apr 2007 17:57 | 1 |
Edited by author 24.04.2007 18:31 |
| Why always crash | visitor | 1019. Line Painting | 24 Apr 2007 16:00 | 2 |
if you use c++, you can't use conio.h and its functions |
| if S=500,T=500, how long the answer may be? | wubin_s1 | 1549. Another Japanese Puzzle | 24 Apr 2007 14:26 | 2 |
|
| Incorrect statement | Vedernikoff Sergey | 1543. Dance Revolution | 24 Apr 2007 12:44 | 4 |
Don't you know why so few people solved this problem? Because of incorrect statement (at least, its russian version). Read: "4. Если нужная клавиша была нажата первым шагом в соответствующем степе, и с начала периода прошло менее 40% периода, то игрок получает «PERFECT», менее 70% — «GREAT», и не менее 70% — «GOOD»." But in tests player gets, for instance, PERFECT, if NOT MORE than 40% of time elapsed (but from the statement STRICTLY LESS). I got AC during the contest only after corecting my program (+4 :((() This is very bad - errors in statement in realisation problems :((( See line 25 of your code: inc (time); Why do you do this? That is why you need to change "less" to "less or equal". Edited by author 23.04.2007 18:16See line 25 of your code: inc (time); Why do you do this? That is why you need to change "less" to "less or equal". Fixed. Thanks :) Statements are correct. I've just AC'ed it, considering that statements are correct. Maybe you had some problems with float arithmetic? |
| No subject | Nanjoutai | 1002. Phone Numbers | 24 Apr 2007 06:59 | 1 |
Edited by author 25.04.2007 06:30 |
| array of consts | Uran | 1352. Mersenne Primes | 23 Apr 2007 17:05 | 1 |
|
| If somebody can help... | Mihalcea Maricel | 1542. Autocompletion | 23 Apr 2007 09:35 | 2 |
I also used preprocesing... and for all my examples it works... why can't it pass test 1 ?!?!?!?! It's because you put empty line in the end of output. Edited by author 23.04.2007 09:36 |
| PLease, give me some tests | Antikr | 1542. Autocompletion | 22 Apr 2007 19:07 | 1 |
I've got WA5 ad I do'nt imagine what is the problem. |
| i got ac, but don't understand how! please, send me your sol! | EfremovAleksei | 1533. Fat Hobbits | 22 Apr 2007 17:28 | 2 |
efrcom [at] inbox [dot] ru Edited by author 04.05.2007 01:03 |
| N log^2 N - TLE | Crazy_serbs | 1542. Autocompletion | 22 Apr 2007 16:42 | 7 |
Hi, i coulnd't find anything better than N log^2 N solution for this taks, but it gives me TLE at 12 test case. Any hint for better approach? all strings are up to 15 characters long, so i used preprocessing for each of the length Mine is O( NlogN + MlogM + (N*15)logM ). It still got AC , and of course , not so fast ( ~ 2.8 s ). It can be faster but that's enough. I think you should optimize your code . Your complexity is fast enough. Is it smart search on the tree or I can use binary search with some precalculations? Can you explain in details the preprocessing of the strings ? for each _len_ length of a string sort the original array using following ordering: 1. first _len_ chars of a string 2. number of times it is encountered, desc 2. whole string I do the same but still have TLE on this server :( Although my computer process any test within 2.6 s Edited by author 22.04.2007 16:48 |
| Another clarification | Ruben Spaans | 1543. Dance Revolution | 22 Apr 2007 12:25 | 2 |
What happens if several of the dance point conditions are fulfilled? For example, the player misses on the first step, bringing the dance points<0, and then hitting the remaining steps perfectly, getting >=80% dance points (given that the song is long enough). Should he get an A or an E? In general, should the highest-scoring fulfilled condition be taken? Edited by author 21.04.2007 18:56 If you not sure exactly, try both variants :) |
| Changes in problem 1069 (+) | Sandro (USU) | 1069. Prufer Code | 22 Apr 2007 01:23 | 4 |
Now all tests contain EOLN character after the last line of input. Use "seekeof" instead of "eof". Many authors now have WA1, TL1 or Crash1, but some others with such old verdicts got AC. Besides, some new tests were added to the problem. I implemented as below: while(!feof(stdin)) { ... } How could I change my program? For example: while (scanf("%d",&next)==1) { ... } |
| Crash (access violation) on test #7 | Itania | 1542. Autocompletion | 22 Apr 2007 00:28 | 1 |
Crash (access violation) on test #7 - what is wrong? Help. write, please, test #7. |
| Want translate | Riddler | 1050. Preparing an Article | 21 Apr 2007 20:09 | 1 |
Please, send me the russian translate of this text. My mail: Riddler@a.ua |
| Contest is finished. Congratulations to Orel STU Encore! | Vladimir Yakovlev (USU) | | 21 Apr 2007 17:25 | 3 |
Good contest I enjoyed it very much ! |
| Why WA 21 ? | Vas | 1549. Another Japanese Puzzle | 21 Apr 2007 17:22 | 1 |
|