結果
| 問題 | No.1995 CHIKA Road |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2022-08-10 12:14:47 |
| 言語 | C90(gcc15) (gcc 15.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,108 bytes |
| 記録 | |
| コンパイル時間 | 108 ms |
| コンパイル使用メモリ | 26,196 KB |
| 最終ジャッジ日時 | 2026-02-24 01:09:38 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'radix_sort_aux':
main.c:12:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
12 | for(int i=0;i<1024;++i){
| ^~~
main.c:12:9: note: use option '-std=c99', '-std=gnu99', '-std=c11' or '-std=gnu11' to compile your code
main.c:15:17: error: redefinition of 'i'
15 | for(int i=0;i<n;++i){
| ^
main.c:12:17: note: previous definition of 'i' with type 'int'
12 | for(int i=0;i<1024;++i){
| ^
main.c:15:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
15 | for(int i=0;i<n;++i){
| ^~~
main.c:19:17: error: redefinition of 'i'
19 | for(int i=0;i<1024;++i){
| ^
main.c:15:17: note: previous definition of 'i' with type 'int'
15 | for(int i=0;i<n;++i){
| ^
main.c:19:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
19 | for(int i=0;i<1024;++i){
| ^~~
main.c:24:17: error: redefinition of 'i'
24 | for(int i=0;i<n;++i){
| ^
main.c:19:17: note: previous definition of 'i' with type 'int'
19 | for(int i=0;i<1024;++i){
| ^
main.c:24:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
24 | for(int i=0;i<n;++i){
| ^~~
main.c: In function 'radix_sort':
main.c:34:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
34 | for(int i=0;i<n;++i){
| ^~~
main.c: In function 'main':
main.c:6:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
6 | #define rep(v,e) for(long v=0;v<e;++v)
| ^~~
main.c:47:9: note: in expansion of macro 'rep'
47 | rep(i,m){
| ^~~
main.c:51:20: warning: passing argument 1 of 'radix_sort' from incompatible pointer type [-Wincomp
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#define rd() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define wt(v) {ulong _z=v;do*--wp=_z%10+48;while(_z/=10);}
#define rep(v,e) for(long v=0;v<e;++v)
typedef unsigned long ulong;
void radix_sort_aux(ulong*a,ulong*b,int n){
int c[1024];
for(int i=0;i<1024;++i){
c[i]=0;
}
for(int i=0;i<n;++i){
++c[a[i]&1023];
}
int t=0;
for(int i=0;i<1024;++i){
int u=c[i];
c[i]=t;
t+=u;
}
for(int i=0;i<n;++i){
b[c[a[i]&1023]++]=a[i]>>10|a[i]<<54;
}
}
void radix_sort(ulong*a,int n){
static ulong b[100000];
radix_sort_aux(a,b,n);
radix_sort_aux(b,a,n);
radix_sort_aux(a,b,n);
for(int i=0;i<n;++i){
a[i]=b[i]>>34|b[i]<<30;
}
}
typedef struct { unsigned b,a; } AB;
AB ab[100000];
int main(){
char*mmap();
char*rp=mmap(0l,1l<<25,1,2,0,0ll);
long n=rd();
long m=rd();
rep(i,m){
ab[i].a=rd();
ab[i].b=rd();
}
radix_sort(ab,m);
long z=n*2-2;
long c=0;
rep(i,m){
if(!(ab[i].a<c)){
--z;
c=ab[i].b;
}
}
char wbuf[64],*wp=wbuf+sizeof wbuf;
wt(z);
write(1,wp,wbuf+sizeof wbuf-wp);
_exit(0);
}
tails