Submission #931977

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9319772024-02-22 17:24:10sleepntsheepStreet Lamps (APIO19_street_lamps)C11
100 / 100
1836 ms37200 KiB
#include<stdio.h>
#define N 300005
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,tune=native")
int abs(int x){return x<0?-x:x;}
unsigned X=12345;int rand_(){return(X*=3)>>1;}
int (*compar)(int,int);
void sort(int*aa,int l,int r){
while(l<r){int i=l,j=l,k=r,tmp,p=aa[l+rand_()%(r-l)];
while(j<k)switch(compar(aa[j],p)){case 0:++j;break;case -1:tmp=aa[j],aa[j]=aa[i],aa[i]=tmp,++i,++j;break;case 1:--k,tmp=aa[j],aa[j]=aa[k],aa[k]=tmp;break;}
sort(aa,l,i);l=k;
}
}
void f_u(int*t,int p,int k){ for(;p<N;p+=p&-p)t[p]+=k; }
int f_q(int*t,int p){int z=0;for(;p;p-=p&-p)z+=t[p];return z;}
int f_lb(int*t,int k){if(!k)return 0;int p=0,z=0;for(int j=1<<19;j>>=1;)if(p+j<N&&z+t[p+j]<k)z+=t[p+=j];return p+1;}
int f[2][N],p[1<<20][3],pn,q[1<<20][4],qn,n,Q;char s[N],op[7];
int pq[1<<21][4],m,ans[1<<19],ansn[1<<19];
int o1[1<<21],o2[1<<21];
void A(int a,int b,int t){if(a<1)a=1;if(b>n)b=n;p[pn][0]=a,p[pn][1]=b,p[pn++][2]=t;}
int cmprb(int i,int j){return pq[i][1]<pq[j][1]?1:(pq[i][1]>pq[j][1]?-1:(~pq[i][3]&&~pq[j][3]?0:(~pq[i][3]?1:~pq[j][3]?-1:0)));
}
int cmprx(int i,int j){
i=o1[i],j=o1[j];
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

street_lamps.c: In function 'cmprx':
street_lamps.c:34:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   34 |     if(~pq[i][3])return 1;if(~pq[j][3])return -1;
      |     ^~
street_lamps.c:34:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   34 |     if(~pq[i][3])return 1;if(~pq[j][3])return -1;
      |                           ^~
street_lamps.c: In function 'main':
street_lamps.c:71:12: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   71 | int main(){scanf("%d%d%s",&n,&Q,s+1);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~
street_lamps.c:74:27: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   74 | for(int i=1,a,b;i<=Q;++i){scanf("%s%d",op,&a);
      |                           ^~~~~~~~~~~~~~~~~~~
street_lamps.c:75:18: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   75 |     if(*op=='q'){scanf("%d",&b);q[qn][0]=a,q[qn][1]=--b,q[qn][2]=i;q[qn][3]=qn;++qn;}
      |                  ^~~~~~~~~~~~~~
#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...