結果
問題 | No.1708 Quality of Contest |
ユーザー | tails |
提出日時 | 2021-11-15 16:38:15 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 1,533 bytes |
コンパイル時間 | 1,735 ms |
コンパイル使用メモリ | 31,744 KB |
実行使用メモリ | 8,960 KB |
最終ジャッジ日時 | 2024-12-14 21:45:20 |
合計ジャッジ時間 | 5,322 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
コンパイルメッセージ
main.c: In function 'radix_sort': main.c:38:20: warning: initialization of 'unsigned int *' from incompatible pointer type 'long unsigned int *' [-Wincompatible-pointer-types] 38 | unsigned*b=a+n; | ^ main.c:39:26: warning: passing argument 2 of 'radix_sort_aux' from incompatible pointer type [-Wincompatible-pointer-types] 39 | radix_sort_aux(a,b,n); | ^ | | | unsigned int * main.c:10:51: note: expected 'long unsigned int *' but argument is of type 'unsigned int *' 10 | void radix_sort_aux(unsigned long*a,unsigned long*b,int n){ | ~~~~~~~~~~~~~~^ main.c:40:24: warning: passing argument 1 of 'radix_sort_aux' from incompatible pointer type [-Wincompatible-pointer-types] 40 | radix_sort_aux(b,a,n); | ^ | | | unsigned int * main.c:10:35: note: expected 'long unsigned int *' but argument is of type 'unsigned int *' 10 | void radix_sort_aux(unsigned long*a,unsigned long*b,int n){ | ~~~~~~~~~~~~~~^ main.c:41:26: warning: passing argument 2 of 'radix_sort_aux' from incompatible pointer type [-Wincompatible-pointer-types] 41 | radix_sort_aux(a,b,n); | ^ | | | unsigned int * main.c:10:51: note: expected 'long unsigned int *' but argument is of type 'unsigned int *' 10 | void radix_sort_aux(unsigned long*a,unsigned long*b,int n){ | ~~~~~~~~~~~~~~^ main.c:42:24: warning: passing argument 1 of 'radix_sort_aux' from incompatible pointer type [-Wincompatible-pointer-types] 42 | radix_sort_aux(b,a,n); | ^ | | | unsigned int * main.c:
ソースコード
#pragma GCC optimize("Ofast")#pragma GCC target("avx2")char*mmap();#define rd_skip() while(*rp++>=48)#define rd(v) long v=0;{long _c;while(_c=*rp++-48,_c>=0)v=v*10+_c;}#define wt(v) {long _z=v;do*--wp=_z%10+48;while(_z/=10);}#define rep(v,e) for(long v=0;v<e;++v)void radix_sort_aux(unsigned long*a,unsigned long*b,int n){int c[256];for(int i=0;i<256;++i){c[i]=0;}for(int i=0;i<n;++i){++c[a[i]&255];}int t=0;for(int i=256;i--;){int u=c[i];c[i]=t;t+=u;}for(int i=0;i<n;++i){b[c[a[i]&255]++]=a[i]>>8|a[i]<<56;}}void radix_sort_32(unsigned long*a,int n){unsigned long*b=a+n;radix_sort_aux(a,b,n);radix_sort_aux(b,a,n);radix_sort_aux(a,b,n);radix_sort_aux(b,a,n);}void radix_sort(unsigned long*a,int n){unsigned*b=a+n;radix_sort_aux(a,b,n);radix_sort_aux(b,a,n);radix_sort_aux(a,b,n);radix_sort_aux(b,a,n);radix_sort_aux(a,b,n);radix_sort_aux(b,a,n);radix_sort_aux(a,b,n);radix_sort_aux(b,a,n);}unsigned long ab[400000];char u[200001];main(){char*rp=mmap(0l,1l<<25,1,2,0,0ll);rd(n);rd_skip();rd(x);rep(i,n){rd(a);rd(b);ab[i]=a|b<<32;}radix_sort_32(ab,n);rep(i,n){long a=ab[i]>>32;long b=(unsigned)ab[i];if(!u[b]){u[b]=1;a+=x;}ab[i]=a;}radix_sort(ab,n);{long s=0;rep(i,n){long t=s+ab[i];ab[i]=s;s=t;}ab[n]=s;}{rd(k);long z=0;rep(i,k){rd(c);z+=ab[c];}char wbuf[64],*wp=wbuf+sizeof wbuf;wt(z);write(1,wp,wbuf+sizeof wbuf-wp);}_exit(0);}