結果
問題 | No.2249 GCDistance |
ユーザー |
![]() |
提出日時 | 2023-03-18 14:02:32 |
言語 | C90 (gcc 12.3.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,120 bytes |
コンパイル時間 | 145 ms |
コンパイル使用メモリ | 26,880 KB |
最終ジャッジ日時 | 2025-02-07 22:29:28 |
合計ジャッジ時間 | 2,183 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'f0': main.c:20:14: error: expected ';' before 'i' 20 | rep3(i,1,N>>1){ | ^ main.c:10:35: note: in definition of macro 'rep3' 10 | #define rep3(v,s,e) for(typeof(e) v=s;v<e;++v) | ^ main.c:20:14: error: 'i' undeclared (first use in this function) 20 | rep3(i,1,N>>1){ | ^ main.c:10:39: note: in definition of macro 'rep3' 10 | #define rep3(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 | rep3(i,1,N>>1){ | ^ main.c:10:39: note: in definition of macro 'rep3' 10 | #define rep3(v,s,e) for(typeof(e) v=s;v<e;++v) | ^ main.c:24:14: error: expected ';' before 'i' 24 | rep3(i,3,N){ | ^ main.c:10:35: note: in definition of macro 'rep3' 10 | #define rep3(v,s,e) for(typeof(e) v=s;v<e;++v) | ^ main.c:32:30: error: expected ';' before 'j' 32 | rep4(j,i,N,i){ | ^ main.c:11:37: note: in definition of macro 'rep4' 11 | #define rep4(v,s,e,t) for(typeof(e) v=s;v<e;v+=t) | ^ main.c:32:30: error: 'j' undeclared (first use in this function) 32 | rep4(j,i,N,i){ | ^ main.c:11:41: note: in definition of macro 'rep4' 11 | #define rep4(v,s,e,t) for(typeof(e) v=s;v<e;v+=t) | ^
ソースコード
#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_skip() while(*rp++>=48) #define rd() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;}) #define WTHI(v) {ulong _z=v,_n=0,_d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(ulong*)wp=_d;wp+=_n;} #define WTLO(v) {ulong _z=v,_n=8,_d=0;while(_d=_d<<8|0x30|_z%10,_z/=10,--_n);*(ulong*)wp=_d;wp+=8;} #define wt(v) if(v>=100000000){WTHI(v/100000000);WTLO(v);}else{WTHI(v);} #define rep3(v,s,e) for(typeof(e) v=s;v<e;++v) #define rep4(v,s,e,t) for(typeof(e) v=s;v<e;v+=t) #define N 10000002 typedef unsigned long ulong; char wbuf[1<<25]; ulong d[N]; void f0(){ rep3(i,1,N>>1){ d[i*2+0]=i; d[i*2+1]=i*2+1; } rep3(i,3,N){ if(d[i]==i){ unsigned v=i; v*=2-i*v; v*=2-i*v; v*=2-i*v; v*=2-i*v; v*=i-1; rep4(j,i,N,i){ d[j]=(unsigned)d[j]*v; } } d[i]=d[i-1]-d[i]+i*2-2; } } void f1(){ rd_init(); rd_skip(); char*wp=wbuf; do{ ulong z=d[rd()]; wt(z); *wp++='\n'; }while(*rp); write(1,wbuf,wp-wbuf); } int main(){ f0(); f1(); _exit(0); }