Common BoardShow all threads Hide all threads Show all messages Hide all messages | Why wa #4, please give me some test | Najmaddin Akhundov | 1131. Copying | 20 Nov 2014 07:33 | 1 | #include <iostream> #include <algorithm> using namespace std; int main() { int n, a; cin >> n >> a; if (n == 1) cout << 0 << endl; else { int S = n - 1; //int S = n; for (int i = 1; i <= n; i++) { S = S - min(a, i); if (S <= 0) { cout << i << endl; break; } } } } | WA #3 | Alexander Kutaladze | 1910. Titan Ruins: Hidden Entrance | 19 Nov 2014 21:42 | 1 | WA #3 Alexander Kutaladze 19 Nov 2014 21:42 can anybody give me some tests? | How to get AC 0.015? | PrankMaN | 1880. Psych Up's Eigenvalues | 19 Nov 2014 15:53 | 3 | I've seen few people got AC in 0.015 seconds, but how? I used binary search and each iteration's left border started from the last found number, but not from the beginning of array and got 0.031 seconds. binary search gives n*log^2(n) and its possible to solve this in 3*n if you walk the array with least number on each step and wait until all 3 pointed are same to increase count; I have 0.031 too but i`m sure it is possible to optimize my code (e.g. i`ve placed too many checkers if the array is fully passed) int main() { int ma=0,mb=0,mc=0,an,bn,cn,a[4000],b[4000],c[4000],sum=0; scanf("%d",&an); for(int i=0;i<an;++i) scanf("%d",&a[i]); scanf("%d",&bn); for(int i=0;i<bn;++i) scanf("%d",&b[i]); scanf("%d",&cn); for(int i=0;i<cn;++i) scanf("%d",&c[i]); do { while ((a[ma]==b[mb])&&(b[mb]==c[mc])) { ++sum; ++ma; ++mb; ++mc; if((ma>=an)||(mb>=bn)||(mc>=cn)) break; } if((ma>=an)||(mb>=bn)||(mc>=cn)) break; if(a[ma]==min(min(b[mb],c[mc]),a[ma])) ++ma; else if(b[mb]==min(min(b[mb],c[mc]),a[ma])) ++mb; else if(c[mc]==min(min(b[mb],c[mc]),a[ma])) ++mc; if((ma>=an)||(mb>=bn)||(mc>=cn)) break; } while(1); printf("%d", sum); return 0; } You use Python. There is many useful functions))) My program took only 4 lines))) | PASCAL | fangcun | 2001. Mathematicians and Berries | 19 Nov 2014 15:27 | 1 | PASCAL fangcun 19 Nov 2014 15:27 var a:integer; b:integer; va:integer; vb:integer; ea:integer; eb:integer; ra:integer; rb:integer; boxa:integer; boxb:integer; begin readln(a,b); readln(va,vb);
boxb:=b-(va-a); rb:=b-boxb; readln(ea,eb); boxa:=va-(eb-vb);
writeln(a-boxa,' ',b-boxb);
end. | Help!!!!!!!!Wa on test 11!!!!!!! | Eazy jobb | 1542. Autocompletion | 19 Nov 2014 12:32 | 3 | /* My program got WA on test 11!!! What's wrong with my code? Anyone can help me!!! */ #include <map> #include <set> #include <ctime> #include <cmath> #include <queue> #include <stack> #include <cstdio> #include <vector> #include <string> #include <cstdlib> #include <cstring> #include <utility> #include <iostream> #include <algorithm> #define FI first #define SE second #define LSON(x) (x<<1) #define RSON(x) ((x<<1)|1) #define Benefit(x,y) x=max(x,y) #define CS const static #define SORT_CMP(s,l,r,cmp) sort(s+(l),s+(r)+1,cmp) #define SORT(s,l,r) sort(s+(l),s+(r)+1) #define MP(x,y) make_pair(x,y) #define Randomize srand( (unsigned int) time ( NULL ) ) #define INOUT(x,y) freopen(x,"r",stdin),freopen(y,"w",stdout) using namespace std; typedef char name[20]; CS int MaxN = 100010 ; struct word { name x; int val,len; word() {x[0] = 0; val = 0;} }; struct Trie { Trie * next[26]; word * ans[10]; Trie() { for(int i=0;i<26;i++) next[i] = NULL ; for(int i=0;i<10;i++) ans[i] = NULL ; } } * Tree; word p[MaxN]; name ask; int n,m,asklen; void Insert(Trie * x,int _y,int pos) { int i; word & y = p[_y]; for(i=0;i<10;i++) if((x->ans[i]==NULL)||(x->ans[i]->val<y.val)) break; if(i<10) { for(int j=9;j>i;j--) x -> ans[j] = x->ans[j-1]; x -> ans[i] = p + _y; } if(pos!=y.len) { int u = y.x[pos] - 'a'; if(!x->next[u]) x -> next[u] = new Trie ; Insert(x->next[u],_y,pos+1); } } void Init() { scanf("%d\n",&n); Tree = new Trie ; for(int i=1;i<=n;i++) { scanf("%s %d\n",p[i].x,&p[i].val); p[i].len=strlen(p[i].x); Insert(Tree,i,0); } } void Query(Trie * x,int pos) { if(pos == asklen) { for(int i=0;i<10;i++) if(x->ans[i]) printf("%s\n",x->ans[i]->x); else break; return ; } int u = ask[pos] - 'a'; if(x->next[u]) Query(x->next[u],pos+1); } void Solve() { scanf("%d\n",&m); while(m--) { scanf("%s\n",ask); asklen = strlen(ask) ; Query(Tree,0); if(m) printf("\n"); } } int main() { Init(); Solve(); return 0; } Edited by author 31.05.2012 14:40 you are an idiot. why so many inclusions? and your code is delirium. ...wrote Nikolay, 43 solved problems and 6000+-th place, to blablabla, 280 solved problems and place within top 1000. P.S. And the code style is not great, but quite okay. Edited by author 19.11.2014 12:32 | Easy problem. | Gleb_Kazantaev(NNSTU) | 1779. The Great Team | 18 Nov 2014 13:53 | 1 | Some hint: For n = 4 1 : (1,2), (1,3), (1,4); 2 : (2,1), (2,3); 3 : (3,1), (3,2); 4 : (4,1); 1st have 3 friends, 2nd have 2 friends, 3d have 2 friends, 4fth have 1 friend, so ans is 4 1 2 1 3 1 4 2 3 | HELP FIRST TEST | Yerevan RAU 5 | 2014. Zhenya moves from parents | 18 Nov 2014 12:53 | 3 | FOR 5 -1000 10.09 21:00 +500 09.09 14:00 +1000 02.09 00:00 -1000 17.09 21:00 +500 18.09 13:00 ANSWER IS -1000 -500 0 -500 -500 OR -1000 -500 0 -500 0 The first one. Jenya never puts earned money into the credit account. why then the 2nd debt is -500 not -1000? date,understand Edited by author 18.11.2014 13:14 | WHY WA 4 . | AngDS120 | 1404. Easy to Hack! | 17 Nov 2014 12:24 | 8 | please help me !!!!!!!! I submissions 14 time this is my code #include<stdio.h> int main() { char str0[100]; int str1[100],str2[100],str3[100]; int i,len=0; gets(str0); for(i=0;str0[i]!='\0';i++,len++) str1[i]=str0[i]-'a';
str2[0]=str1[0]; for(i=1;i<len;i++) { str2[i]=str1[i]; while(str2[i]<str2[i-1]) { str2[i]+=26;
} }
str3[0]=str2[0]-5; for(i=0;i<len;i++) str3[i+1]=str2[i+1]-str2[i];
for(i=0;i<len;i++) printf("%c",(str3[i]%26)+'a');
} Edited by author 28.11.2006 22:06 Edited by author 28.11.2006 22:08 not (a[0] in ['a'..'z'])!! What I wanna tell you is that this problem is really easy to solve. You only need to have a really good thinking. Try to find the changes between each letters or numbers. Then you'll work it out! The problem is that you haven't considered the case where str[0]<'a'+5. In this case when you do str[0]-=5 at the end a value lesser than 'a' may be obtained. Hence at the end if (str[0]-=5)<0 then str[0]+=26. Try this test case once bimdhhycaoinese Answer should be whereareyoufrom you get [hereareyoufrom if you havent taken care of the condition. <<jagatsastry>> A lot of Thanks)) <jagatsastry> Thank you very much for explanation <jagatsastry> Thank you very much for explanation | WA 4 | Catalin Cocis | 1580. Dean's Debts | 16 Nov 2014 22:55 | 4 | WA 4 Catalin Cocis 3 Apr 2010 01:05 What is wrong with test 4? 5 6 5 4 9 4 2 6 5 1 6 1 2 3 5 3 8 3 2 5 Re: WA 4 Nathan Wildenberg 16 Nov 2014 22:55 0.00 3.00 2.00 3.00 6.00 Isn't this the correct answer? :? Nevermind, it is actually undeterminable. Edited by author 16.11.2014 22:56 Edited by author 16.11.2014 23:08 | WA 10 | Alexandr | 1787. Turn for MEGA | 16 Nov 2014 20:21 | 1 | WA 10 Alexandr 16 Nov 2014 20:21 /// What's wrong? var a,b,c,i,s:integer; m:array[1..1000000] of integer; begin s:=0; read(a); read(b); for i:=1 to b do begin read(m[i]); if(m[i]>a) then s:=s+m[i]-a else begin if s>m[i]+a then s:=s-m[i]-a else s:=0; end; end; if s<0 then writeln(0) else writeln(s); end. | help me with tests | Georgy Mogafk | 1086. Cryptography | 16 Nov 2014 19:33 | 2 | I found my error. I was searched all multiples of i<=LIMIT, whereas right i*i<=LIMIT. Now my code not run firsth test..but i am sure that result is correct. Please, give me some input data for test. | Дайте тест №2 | ya_diman | 1086. Cryptography | 16 Nov 2014 18:45 | 7 | Дайте тест №2, ну или все тесты на эту задачу!!! For example: 4 15000 14000 15000 14000 It can be test if you have TLE, try this 15000 15000 15000 ... 15000 (15001 lines) or 15000 1 2 ... 14999 15000 Hint for check: 15000th prime number is 163841 you sure that 15000th prime number is 163841? i think that it 163847 | Stupid mistakes | bsu.mmf.team | 2036. Intersect Until You're Sick of It | 16 Nov 2014 16:08 | 1 | Please don't make so stupid mistakes that I did. Lost about 3 hours on the contest, gratz to me. Anti-WA #51: 4 0 0 2 0 1 1 1 2 Answer: oo Anti-WA #52: 4 0 0 1 2 2 2 3 0 Answer: oo | very easy solution on Java | Evgeniy[VVV] | 1083. Factorials!!! | 16 Nov 2014 15:15 | 2 | it's very simple,especially on java. | Hint (simple) | Najmaddin Akhundov | 1209. 1, 10, 100, 1000... | 16 Nov 2014 08:32 | 1 | The order of 1's within the number is 1 2 4 7 11 16 ...You can find the n'th number in sequence is equal to 1+n*(n-1)/2. So for any given input a, it is sufficient to test whether or not (a-1)*2 is equal to multiplication of two consequence number. I hope it helps | WA 4 | mushfiq | 1581. Teamwork | 16 Nov 2014 02:40 | 2 | WA 4 mushfiq 24 Oct 2014 18:03 What is test case 4? please help yes, give 4 test Edited by author 16.11.2014 02:42 | wh | Georgy Mogafk | 1149. Sinus Dances | 15 Nov 2014 23:34 | 1 | wh Georgy Mogafk 15 Nov 2014 23:34 | WA#1, please, help me | Ivan Metelev | 1020. Rope | 15 Nov 2014 16:01 | 1 | var n,i: integer; x1,x2,y2,y1,xx,yy,e,r: real; begin readln(n,r); readln(x1,y1); yy:=y1; xx:=x1; for i:=2 to n do begin readln(x2,y2); e:=e+sqrt(sqr(x2-x1)+sqr(y2-y1)); x1:=x2; y1:=y2; end; writeln((round((e+2*3.14159*r+sqrt(sqr(xx-x1)+sqr(yy-y1)))*100))/100); end. | Memory_Limit | Nodir | 1553. Caves and Tunnels | 14 Nov 2014 22:12 | 1 | I'm using Heavy light Decomposition an I'm getting ML in test 9 WHY ???? | What is test #7? | Alexey Krupnitskiy | 1200. Horns and Hoofs | 14 Nov 2014 17:17 | 1 | could you give me test #7? I can not understand what is wrong! |
|
|