Submission #952184

#TimeUsernameProblemLanguageResultExecution timeMemory
952184sleepntsheepLightning Rod (NOI18_lightningrod)C11
0 / 100
46 ms7504 KiB
unsigned X=12345;int rand_(){return(X*=3)/2;} int(*compar)(int,int); void sort(int*aa,int l,int r) { while(l<r) { int i=l,j=l,k=r,t,p=aa[l+rand_()%(r-l)]; while(j<k) switch(compar(aa[j],p)) { case 0:++j;break; case -1:t=aa[j],aa[j]=aa[i],aa[i]=t,++i,++j;break; case 1:t=aa[--k],aa[k]=aa[j],aa[j]=t;break; } sort(aa,l,i); l=k; } } #include<stdio.h> #define N 200005 int n,x[N],y[N],o[N],z,far; int c(int i,int j) { if(x[i]==x[j])return y[i]>y[j]?-1:y[i]<y[j]?1:0; return x[i]<x[j]?-1:x[i]>x[j]?1:0; } int main() { scanf("%d",&n); for(int i=0;i<n;++i) { scanf("%d%d",x+i,y+i),o[i]=i; int t=x[i]; x[i]=t-y[i]; y[i]=t+y[i]; } compar=c; sort(o,0,n); for(int i=0;i<n;++i) { if(far>=y[o[i]]) ; else far=y[o[i]],++z; } printf("%d",z); }

Compilation message (stderr)

lightningrod.c: In function 'main':
lightningrod.c:34:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |     scanf("%d",&n);
      |     ^~~~~~~~~~~~~~
lightningrod.c:37:9: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |         scanf("%d%d",x+i,y+i),o[i]=i;
      |         ^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...