結果
| 問題 |
No.2821 A[i] ← 2A[j] - A[i]
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2024-07-27 22:37:54 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 1,500 ms |
| コード長 | 1,310 bytes |
| コンパイル時間 | 1,628 ms |
| コンパイル使用メモリ | 26,624 KB |
| 実行使用メモリ | 7,680 KB |
| 最終ジャッジ日時 | 2024-07-27 22:37:58 |
| 合計ジャッジ時間 | 3,439 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 33 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:52:9: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
52 | write(1,wbuf,wp-wbuf);
| ^~~~~
main.c:53:9: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
53 | _exit(0);
| ^~~~~
main.c:53:9: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
ソースコード
#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 rd_long() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define rd_signed() ({long _s=*rp=='-'&&++rp,_v=rd_long();_s?-_v:_v;})
#define WTHI(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 WTLO(v) {unsigned _z=v,_n=8;long _d=0;while(_d=_d<<8|0x30|_z%10,_z/=10,--_n);*(long*)wp=_d;wp+=8;}
#define wt(v) if(v>=100000000){if(v>=10000000000000000l){WTHI(v/10000000000000000l);WTLO(v/100000000%100000000);}else WTHI(v/100000000);WTLO(v%100000000);}else{WTHI(v);}
#define times(e) for(typeof(e)_=e;_--;)
typedef unsigned long ulong;
static inline
long gcd(long a,long b){
if(a==0||b==0){
return a+b;
}
long x=__builtin_ctzl(a);
long y=__builtin_ctzl(b);
a>>=x;
b>>=y;
long c;
while(c=a-b){
c>>=__builtin_ctzl(c);
if(c<0){
b=-c;
}else{
a=c;
}
}
return a<<(x<=y?x:y);
}
char wbuf[1<<25];
int main(){
char*wp=wbuf;
rd_init();
int n=rd();
long b=rd_signed();
ulong g=0;
*wp++='0';
*wp++='\n';
times(n-1){
long a=rd_signed()-b;
g=gcd(g,a<0?-a:a);
wt(g);
*wp++='\n';
}
write(1,wbuf,wp-wbuf);
_exit(0);
}
tails