結果
問題 | No.14 最小公倍数ソート |
ユーザー |
![]() |
提出日時 | 2024-04-25 11:28:10 |
言語 | C90 (gcc 12.3.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,143 bytes |
コンパイル時間 | 279 ms |
コンパイル使用メモリ | 27,648 KB |
最終ジャッジ日時 | 2025-03-19 10:16:14 |
合計ジャッジ時間 | 1,129 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'f0': main.c:20:14: error: expected ';' before 'i' 20 | reps(i,2,10001){ | ^ main.c:8:35: note: in definition of macro 'reps' 8 | #define reps(v,s,e) for(typeof(e) v=s;v<e;++v) | ^ main.c:20:14: error: 'i' undeclared (first use in this function) 20 | reps(i,2,10001){ | ^ main.c:8:39: note: in definition of macro 'reps' 8 | #define reps(v,s,e) for(typeof(e) v=s;v<e;++v) | ^ main.c:20:14: note: each undeclared identifier is reported only once for each function it appears in 20 | reps(i,2,10001){ | ^ main.c:8:39: note: in definition of macro 'reps' 8 | #define reps(v,s,e) for(typeof(e) v=s;v<e;++v) | ^ main.c:21:23: error: expected ';' before 'j' 21 | repst(j,i,10001,i){ | ^ main.c:9:38: note: in definition of macro 'repst' 9 | #define repst(v,s,e,t) for(typeof(e) v=s;v<e;v+=t) | ^ main.c:21:23: error: 'j' undeclared (first use in this function) 21 | repst(j,i,10001,i){ | ^ main.c:9:42: note: in definition of macro 'repst' 9 | #define repst(v,s,e,t) for(typeof(e) v=s;v<e;v+=t) | ^ main.c:25:13: error: expected ';' before 'i' 25 | rep(i,10001){ | ^ main.c:7:32: note: in definition of macro 'rep' 7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v) | ^ main.c: In function 'f1': main.c:34:13: error: expected ';' before 'i' 34 | rep(i,n-1){ | ^ main.c:7:32: note: in definition of macro 'rep' 7 | #define rep(v,e) for(typeof(e) v=0;v<e;++v) | ^ main.c:34:13: error: 'i' undeclared (first use in this function)
ソースコード
#pragma GCC optimize("Ofast")#pragma GCC target("avx2")#define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);})#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})#define wt(v) {unsigned _z=v,_n=0;long _d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(long*)wp=_d;wp+=_n;}#define rep(v,e) for(typeof(e) v=0;v<e;++v)#define reps(v,s,e) for(typeof(e) v=s;v<e;++v)#define repst(v,s,e,t) for(typeof(e) v=s;v<e;v+=t)char wbuf[1<<25];int n;int x;int cs[10001];int dn[10001];short ds[10001][64];int ps[10001];void f0(){reps(i,2,10001){repst(j,i,10001,i){ds[j][dn[j]++]=i;}}rep(i,10001){ps[i]=1;}}void f1(){rd_init();n=rd();x=rd();rep(i,n-1){cs[rd()]+=1;}}void f2(){char*wp=wbuf;wt(x);rep(i,n-1){while(!cs[ps[1]]){ps[1]+=1;}int b=x*ps[1];int y=ps[1];rep(j,dn[x]){int d=ds[x][j];int k;while(k=d*ps[d],k<=10000&&!cs[k]){ps[d]+=1;}if(k<=10000){if(b>x*ps[d]){b=x*ps[d];y=k;}}}*wp++=' ';wt(y);x=y;cs[x]-=1;}write(1,wbuf,wp-wbuf);}int main(){f0();f1();f2();_exit(0);}