Common Board| Show all threads Hide all threads Show all messages Hide all messages | | ACM-contest system | Backs [Rogatnev Sergey] | | 4 Jul 2017 19:45 | 1 | | | Format of input | Felix_Mate | 1941. Scary Martian Word | 4 Jul 2017 17:50 | 2 | Братаны-кодеры в этой задаче нужен особый подход к считыванию Из условия неясно,какой формат,но пока что он следущий(.=пробел): ххх.ххх.ххх и т.д. ууу.ууу.ууу.ууу и т.д. Не используйте на Паскале eof,eoln. Часть моего говнокода: ... s:string[4]; ... len:=1; read(s); inc(c[90*90*(ord(s[1])-33)+90*(ord(s[2])-33)+(ord(s[3])-33)]); f:=length(s)=4; while f do begin inc(len); read(s); inc(c[90*90*(ord(s[1])-33)+90*(ord(s[2])-33)+(ord(s[3])-33)]); f:=length(s)=4; end; ... Timus is not an image board That is not 2ch or 4ch There is no need to use such words | | If you have no idea know why memory limit exceed | Mahilewets | 1039. Anniversary Party | 3 Jul 2017 15:42 | 1 | C++. I was using recursive DFS. vector <vector<int> >. I forgot to pass graph vector by reference and got MLE#8. After noticing that I am passing graph vector by value and simply adding an ampersand before vector name AC 1MB memory used. Edited by author 03.07.2017 15:43 | | If you have WA6 | Human | 2015. Zhenya moves from the dormitory | 3 Jul 2017 14:38 | 1 | 98000 3334 3334 1 25000 3333 3 1 97999 1 2 30000 1 2 25000 1 Answer - You should rent the apartment #1 alone. or You should rent the apartment #2 alone. or You should rent the apartment #3 alone. 21111 1111 7777 5 1111 7777 10000 6556 20000 3131 80000 2 76400 1 4 1 21110 6000 1 21111 6665 2 21111 1220 2 1110 0 Answer - You should rent the apartment #3 alone. 1001 1001 1001 1 1001 1 1 2 1001 1 Answer - You should rent the apartment #1 alone. I hope it can help. My program, which got WA 6, failed on this tests. | | To authors | Felix_Mate | 1974. Similar Tunes | 2 Jul 2017 19:52 | 1 | My AC program gives the wrong answer on the test: 2 1A 1A 1 5 1B 1A 1A 1B 1B =>0.200000000 but rught answer 0.400000000 | | I was trying to solve it using C++ | Mahilewets | 1248. Sequence Sum | 2 Jul 2017 18:30 | 1 | I was trying C++ for several hours. Can't defeat test case No. 7. So, I gave up and got AC using Python Decimal module just after several minutes I stopped trying C++. It is bad I think that I don't solved with C++. Literally no idea why WA#7. I tried rounding and truncation. The result was always the same. | | Why the answer in the first example is 02:00:00 25.00? | Felix_Mate | 1154. Mages Contest | 2 Jul 2017 17:51 | 1 | When time is 02:00:00 Good have power=58 and Evil=60 ((x-40)/(130-40)=7200/36000 => x=58). | | You can simulate in with segment tree | Mahilewets | 1521. War Games 2 | 1 Jul 2017 20:50 | 1 | In your segment tree you have count of zeros on every segment of vector of length N. Find k-th non-zero element. Then zero it. Update tree. Output. | | Solve by sorting. | Mahilewets | 1193. Queue at the Exam | 30 Jun 2017 00:40 | 1 | Sort by T1. Then set timer=0, ans =0. Then for all students in sorted order: if timer<T1 then timer=T1 timer=timer+T2 dtime=timer-T3 if dtime>ans then ans=dtime | | Online tool for 3D plotting | Sirko | 1062. Triathlon | 29 Jun 2017 20:09 | 1 | | | WA Test#19 | Aidar_Valiev | 1837. Isenbaev's Number | 29 Jun 2017 19:17 | 1 | Don't know, what's wrong. Give me tests please. | | Runtime Error | Tanay | 1910. Titan Ruins: Hidden Entrance | 29 Jun 2017 08:56 | 2 | a=[] n=int(input()) for i in range(0,n): f=(int,input()) a.append(f) sum=0 ans=0 for i in range(0,n-2): sum=0 for f in range(i,i+3): sum=sum+a[f] if(sum>ans): ans=sum z=f print(ans) print(z) #What could be the error in this. It works on my computer. Why do they show runtime error #when submitted?? Because of the way you are getting input. http://ideone.com/COmKqTMaybe on your machine you are pressing Enter before after each number. Maybe your interpeter is smarter than mine. You should write: a=list (map (int, input (). split ())) a | | WA 12 | zlo | 2072. Kirill the Gardener 3 | 29 Jun 2017 01:31 | 1 | WA 12 zlo 29 Jun 2017 01:31 long long at least, otherwise WA12. doesn't fit even in unsigned long | | WA on test 9 | zhaimingshuzms | 1966. Cycling Roads | 28 Jun 2017 16:40 | 1 | What's wrong? #include<cstdio> using namespace std; const int N=201; struct Node{int x,y;}a[N]; struct Line{int s,t;}b[N]; int fa[N],n,m,root; inline int direct(Node x,Node y,Node z){ return (y.x-x.x)*(z.y-x.y)-(y.y-x.y)*(z.x-x.x); } bool online(Node x,Line y){//right Node be=a[y.s],en=a[y.t]; if (x.x<be.x||x.x>en.x) return 0; if (direct(be,x,en)==0) return 1; return 0; } bool cross(Line x,Line y){ Node p1=a[x.s],p2=a[x.t],p3=a[y.s],p4=a[y.t]; if (online(p1,y)||online(p2,y)||online(p3,x)||online(p4,x)) return 1; int d1=direct(p1,p2,p3),d2=direct(p1,p2,p4),d3=direct(p3,p4,p1),d4=direct(p3,p4,p2); if ((d1^d2)<0&&(d3^d4)<0) return 1; return 0; } int find(int x){return x==fa[x]?x:fa[x]=find(fa[x]);} void unite(int x,int y){ x=find(x); y=find(y); if (x<y) fa[y]=x; else if (x>y) fa[x]=y; } int main(){ scanf("%d%d",&n,&m); for (int i=1; i<=n; i++) fa[i]=i; for (int i=1; i<=n; i++) scanf("%d%d",&a[i].x,&a[i].y); for (int i=1; i<=m; i++){ scanf("%d%d",&b[i].s,&b[i].t); unite(b[i].s,b[i].t); for (int j=1; j<=n; j++)if (online(a[j],b[i])) unite(j,b[i].s); for (int j=1; j<i; j++) if (cross(b[i],b[j])) unite(b[i].s,b[j].s); } root=find(1); for (int i=2; i<=n; i++) if (find(i)!=root) {printf("NO"); return 0;} printf("YES"); return 0; } | | What is the best asymptotics? | Felix_Mate | 2092. Bolero | 28 Jun 2017 15:11 | 1 | My algo is O(p*n*logn). Algo: 1)sort pairs <d,s> by d. We get d1<=d2<=d3<=...<=dn. s1 s2 s3 sn 2)For each p we choose a minimal k (if exist pairs <ki,p> and <kj,p> where ki<kj then we delete <kj,p> 3)ans=s[1]+...+s[n]-(x1+x2+...+xn)/100 where xi=s[i]*di or xi=s[i]*p if we choose p (if we choose p => the minimum of the k elements of x are equal to s*p), i=1..n => we must max_sum=(x1+x2+...+xn)->max =>ans=s[1]+...+s[n]-max_sum/100 4)max_sum=s1*d1+...+sn*dn For each p=1..100 find 1<=j<=n | p<dj, j->min (if there is no such j => max_sum=max(max_sum, (s[1]+...+s[n])*p) ) then we take (s[1]+...+s[j-1])*p (s[0]=0); if we took <k elements then we must take lost=k-(j-1) elements from sj,...,sn. We must choose such index i1<i2<...<ilost from j..n | s[i1]*(d[i1]-p)=min(s[i]*(d[i]-p), j<=i<=n, s[i2]*(d[i2]-p)=min(s[i]*(d[i]-p), j<=i<=n,i!=i1, ... . then max_sum=max(max_sum, (s[1]+...+s[j-1])*p + (s[i1]+...+s[ilost])*p+Sum(si*di, j<=i<=n and i<>ik,k=1..lost)). Edited by author 28.06.2017 15:34 | | This is WEIRD | iOli | 1146. Maximum Sum | 28 Jun 2017 13:20 | 3 | My solution passes first 4 test cases and shows memory limit exceeded error at 5th test case. I have made a global 4D array 100*100*100*100 which keeps the result of the sum of a rectangle whose top left corner is x1,y1 and bottom right corner is x2,y2, 4d array mat[x1][y1][x2][y2] stores the sum of the numbers corresponding to that rectangle. Now if this big array were a reason behind memory limit exceeded error than it shouldn't have passed even the first test cases because i made global 4d array of maximum size by default. So what can be the reason? #include <iostream> using namespace std; const int M = 107; int mat[M][M][M][M]; int main() { int n; cin >> n; int arr[n][n]; int ans = -1e9; for (int i=0; i<n; i++) for (int j=0; j<n; j++) { cin >> arr[i][j]; mat[i][j][i][j] = arr[i][j]; if (arr[i][j] > ans) ans = arr[i][j]; } for (int size = 2; size<=n*n; size++) { for (int p=1; p<=size and p<=n; p++) { int q = size/p; if (p*q != size) continue; for (int i=0; i<n-p+1; i++) { for (int j=0; j<n-q+1; j++) { int x1 = i, y1 = j; int x2 = i+p-1, y2 = j+q-1; if (x2-x1 > y2-y1) { mat[x1][y1][x2][y2] = mat[x1][y1][x2-1][y2] + mat[x2][y1][x2][y2]; if (mat[x1][y1][x2][y2] > ans) ans = mat[x1][y1][x2][y2]; } else { mat[x1][y1][x2][y2] = mat[x1][y1][x2][y2-1] + mat[x1][y2][x2][y2]; if (mat[x1][y1][x2][y2] > ans) ans = mat[x1][y1][x2][y2]; } } } } } cout << ans << endl; } Edited by author 26.06.2017 17:06 Edited by author 26.06.2017 17:06 Edited by author 26.06.2017 17:07 Actually, if you don't access your global allocated memory, that memory don't counts. I have noticed that when watching how my solutions are testing. When there is a global array of big size first few cases are low memory. And last test cases are high memory usage. You can find any simple task were you are to output some string. Allocate a HUGE buffer for that string. Then submit your solution. Then allocate a buffer just enough to hold your string and submit again. And you will see that memory usage is the SAME. | | Solved have a question about unsigned integer arithmetic in C/C++ | Mahilewets | 1528. Sequence | 28 Jun 2017 13:12 | 1 | Why if I am trying to precalculate factorials using unsigned long long int there is WA#5? There are 64 last binary digits digits and in this task we are to output at most 32 binary digits. | | Just to know | johny ca$h | 1059. Expression | 27 Jun 2017 23:08 | 1 | There are no tests where N=0 xD) | | who knows test18 please tell me | Stevexx | 1966. Cycling Roads | 27 Jun 2017 12:43 | 1 | #include<cstdio> #include<cstring> #include<iostream> #define pii pair<int,int> #define pdd pair<double,double> #define mp make_pair #define F first #define S second #define N 210 using namespace std; int n,m; int fat[N]; pii e[N]; pdd p[N]; int father(int x) {if(fat[x]!=x) fat[x]=father(fat[x]); return fat[x];} double calc(pii a,pii b,pii c) {return (a.F-c.F)*(b.S-c.S)-(b.F-c.F)*(a.S-c.S);} bool judge(pii a, pii b, pii c, pii d) { if (max(a.F,b.F)<min(c.F,d.F)||max(a.S,b.S)<min(c.S,d.S)||max(c.F,d.F)<min(a.F,b.F)||max(c.S,d.S)<min(a.S,b.S)) return false; if (calc(c,b,a)*calc(b,d,a)<0||calc(a,d,c)*calc(d,b,c)<0) return false; return true; } int main() { int i,j,x,y; scanf("%d %d",&n,&m); for(i=1;i<=n;i++) fat[i]=i; for(i=1;i<=n;i++) {scanf("%lf %lf",&x,&y); p[i]=mp(x,y);} for(i=1;i<=m;i++) {scanf("%d %d",&x,&y); e[i]=mp(x,y); fat[father(x)]=father(y);} for(i=m+1;i<=m+n;i++) e[i]=mp(i-m,i-m); m+=n; for(i=1;i<=m;i++) for(j=i+1;j<=m;j++) if(judge(p[e[i].F],p[e[i].S],p[e[j].F],p[e[j].S])) fat[father(e[i].F)]=father(e[j].F); int stan=father(1); for(i=1;i<=n;i++) if(father(i)!=stan) puts("YES"); return 0; } | | RANDOM solution is OK! | Mahilewets | 1731. Dill | 24 Jun 2017 23:17 | 1 | Just output n random numbers. After that, output m random numbers. All random numbers are in range [1;1e9]. AC first attempt. |
|
|