Common Board#include <iostream> #include <vector> using namespace std; int M, N; int A[30001]; int B[30001]; vector < pair <int, int> > edges; int main() { cin >> M >> N; int K; cin >> K; for (int i = 0; i < K; i++) { int a, b; cin >> a >> b; edges.push_back(make_pair(a, b)); A[a]++; B[b]++; } int count = 0; for (int i = 0; i < edges.size(); i++) { if (A[edges[i].first] > 1 && B[edges[i].second] > 1) { count++; A[edges[i].first]--; B[edges[i].second]--; } } cout << K - count << endl; return 0; } I've got no idea what's wrong. What's the test? Try the test 1 10 That might help even though the answer is obvious :) Memory limit was changed from 16 MB to 64 MB. 12 authors have got AC after rejudge. I have tested all the inputs that was given in disscutions and the output for all of them were correct. When I submit my solution, it gives WA#3. Please give me test 3. consider the case when line is vertical or horizontal and center-x or center-y is within line segment ax and bx or ay and by. #include<iostream> #include<string.h> #include<stdio.h> using namespace std; int main() { char in[200000]; int num ; char c; scanf("%c",&c); char nc = c; if(c == '\n') goto end; in[0] = c; for(num=1;;num++) { scanf("%c",&c); if(c == '\n') break; if(nc == c) { in[num-1] = '\0'; num -= 2; if((num+1) != 0) nc = in[num]; else nc = '\0';
} else { in[num] = c; nc = c; }
} end: for(int i=0;i<=num;i++) cout << in[i];
} got a 0.109s answer.. Edited by author 24.04.2013 23:52 I have checked all test cases, but i still have not AC! Please give me more special tests(( please check for the case when ay==by type ex = extended; var x1,y1,x2,y2,x3,y3,x,y,l,ll,mi,ma,a,b,c,p,k1,k2,b1,b2 : ex; function min (a,b : ex) : ex; begin if a<b then min:=a else min:=b; end; function max (a,b : ex) : ex; begin if a>b then max:=a else max:=b; end; function dist (x1,y1,x2,y2 : ex) : ex; begin dist:=sqrt(sqr(x1-x2)+sqr(y1-y2)); end; procedure wr (mi,ma : ex); begin ma:=ma-l; if ma<0 then ma:=0; mi:=mi-l; if mi<0 then mi:=0; writeln(mi:0:2); writeln(ma:0:2); halt(0); end; begin read(x1,y1,x2,y2,x,y,l); if x1=x2 then begin if (y<=max(y1,y2))and(y>=min(y1,y2))then begin mi:=abs(x-x2); ma:=max(dist(x,y,x1,y1),dist(x,y,x2,y2)); wr(mi,ma); end; ma:=max(dist(x,y,x1,y1),dist(x,y,x2,y2)); mi:=min(dist(x,y,x1,y1),dist(x,y,x2,y2)); wr(mi,ma); end; if y1=y2 then begin if (x<=max(x1,x2))and(x>=min(x1,x2))then begin mi:=abs(y1-y); mi:=mi-l; ma:=max(dist(x,y,x1,y1),dist(x,y,x2,y2)); wr(mi,ma); end; ma:=max(dist(x,y,x1,y1),dist(x,y,x2,y2)); mi:=min(dist(x,y,x1,y1),dist(x,y,x2,y2)); wr(mi,ma); end; a:=dist(x1,y1,x,y); b:=dist(x2,y2,x,y); c:=dist(x1,y1,x2,y2); p:=(a+b+c)/2; ll:=2*sqrt(p*(p-a)*(p-b)*(p-c))/c; k1:=(y1-y2)/(x1-x2); b1:=y1-k1*x1; k2:=-1/k1; b2:=y-k2*x; x3:=(b2-b1)/(k1-k2); y3:=k1*x3+b1; if (x3<=max(x1,x2))and(x3>=min(x1,x2))and (y3<=max(y1,y2))and(y3>=min(y1,y2))then begin mi:=ll; ma:=max(dist(x,y,x1,y1),dist(x,y,x2,y2)); wr(mi,ma); end else begin ma:=max(dist(x,y,x1,y1),dist(x,y,x2,y2)); mi:=min(dist(x,y,x1,y1),dist(x,y,x2,y2)); wr(mi,ma); end; end. please try for case when ay==by #include <cstdio> char a[300010], k; int main(){ char c; while((c = getchar()) != EOF){ if(k == 0 || a[k - 1] != c) a[k++] = c; else k--; } for(int i = 0; i < k; i++) putchar(a[i]); return 0; } This one gives RE(AV) on the 6th test. I tried it 4 times with different sizes of array "a" (200000, 200010, 300010, 2000000) and each time got this error. I found it very strange, could you help me please? Any tests? Try it in this cases: 1. Only one team. 2. No Isenbaev at all. any idea mobius inversion? Did anyone make it to the time limit using Python 3.3? I make it to memory limit To do it in Python 3.3, forget about numbers. Use only strings and Boyer-Moore algorithm :) [AC CODE] Edited by author 24.01.2006 19:33 Why? Edited by author 23.01.2006 22:29 a'a'a'a'a - five words. thanx a lot , i got AC too!!! Can anyone write for me test 18, plz? Any help would be appreciate! what is test 22? i wa 22 what's wrong? #include<stdio.h> #include<string.h> int n,p,a[1000010],min=1000000,max=0,sum=0,ans=0; int main() { int i,x,j,k; memset(a,0,sizeof(a)); scanf("%d%d",&n,&p); for(i=1; i<=n; i++) { scanf("%d",&x); a[x]++; if(x<min) min=x; if(x>max) max=x; } for(i=min; i<=max; i++) if(a[i]!=0) { if(a[i]*i>=p) break; sum+=a[i]; ans++; } for(k=min; k<i; k++) if(a[k]!=0){ for(j=k+1; j<i; j++) if(a[j]!=0) break; if(a[j]==0) break; if(j*(a[k]+a[j])<p) { ans--; a[j]+=a[k]; a[k]=0; } } printf("%d %d\n",sum,ans); return 0; } Edited by author 10.03.2013 08:41 呃…… Edited by author 10.03.2013 08:48 Edited by author 10.03.2013 08:48 you can cast a spell with power of p Hello i wrote the following code in python , but it takes too much time, hwo should it be improved class timus1073: def __init__(self): pass def problem(self,y): a = [0] + range(1,60001) b = [x**2 for x in range(1,246)] for i in b: j = 0 while j+i <= 60000: if (a[j+i] > a[j] + 1): a[j+i] = a[j] + 1 j = j + 1 return a[y] if __name__ == "__main__": p = timus1073() a = input() print p.problem(int(a)) |
|