結果
| 問題 |
No.1932 動く点 P / Moving Point P
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2022-05-11 16:07:02 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 6,000 ms |
| コード長 | 1,165 bytes |
| コンパイル時間 | 1,043 ms |
| コンパイル使用メモリ | 34,424 KB |
| 実行使用メモリ | 13,440 KB |
| 最終ジャッジ日時 | 2024-07-19 01:13:08 |
| 合計ジャッジ時間 | 15,431 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 11 |
コンパイルメッセージ
main.c:13:13: warning: no semicolon at end of struct or union
13 | struct{C r,t} ms[100001];
| ^
main.c:15:1: warning: return type defaults to 'int' [-Wimplicit-int]
15 | main(){
| ^~~~
main.c: In function 'main':
main.c:5:26: warning: initialization of 'long int' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
5 | #define rdf() ({long neg=*rp=='-'?++rp:0,a=rd(),b=rd();(neg?-1:1)*(a+b*1e-6);})
| ^
main.c:22:26: note: in expansion of macro 'rdf'
22 | double p=rdf(),q=rdf(),r=rdf(),c,s;
| ^~~
main.c:5:26: note: (near initialization for 'p')
5 | #define rdf() ({long neg=*rp=='-'?++rp:0,a=rd(),b=rd();(neg?-1:1)*(a+b*1e-6);})
| ^
main.c:22:26: note: in expansion of macro 'rdf'
22 | double p=rdf(),q=rdf(),r=rdf(),c,s;
| ^~~
main.c:5:26: warning: initialization of 'long int' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
5 | #define rdf() ({long neg=*rp=='-'?++rp:0,a=rd(),b=rd();(neg?-1:1)*(a+b*1e-6);})
| ^
main.c:22:34: note: in expansion of macro 'rdf'
22 | double p=rdf(),q=rdf(),r=rdf(),c,s;
| ^~~
main.c:5:26: note: (near initialization for 'q')
5 | #define rdf() ({long neg=*rp=='-'?++rp:0,a=rd(),b=rd();(neg?-1:1)*(a+b*1e-6);})
| ^
main.c:22:34: note: in expansion of macro 'rdf'
22 | double p=rdf(),q=rdf(),r=rdf(),c,s;
| ^~~
main.c:5:26: warning: initialization of 'long int' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
5 | #define rdf() ({long neg=*rp=='-'?++rp:0,a=rd(),b=rd();(neg?-1:1)*(a+b*1e-6);})
| ^
main.c:22:42: note: in expansion of macro 'rdf'
22 |
ソースコード
#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 rdf() ({long neg=*rp=='-'?++rp:0,a=rd(),b=rd();(neg?-1:1)*(a+b*1e-6);})
#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 wtf(v) ({double _a=v;if(_a<0)*wp++='-',_a=-_a;ulong x=(ulong)_a;WTHI(x);*wp++='.';long y=(ulong)((_a-x)*1e3);*wp++='0'+(y/100)%10;*wp++='0'+(y/10)%10;*wp++='0'+y%10;})
typedef unsigned long ulong;
char wbuf[1<<25];
typedef __typeof(1.j) C;
struct{C r,t} ms[100001];
main(){
char*mmap();
char*rp=mmap(0l,1l<<25,1,2,0,0ll);
long n=rd();
ms[0].r=1;
ms[0].t=0;
for(long i=0;i<n;++i){
double p=rdf(),q=rdf(),r=rdf(),c,s;
sincos(3.14159265358979/180*r,&s,&c);
C mr=c+s*1j;
C mt=(1-c-s*1j)*(p+q*1j);
ms[i+1].r=mr*ms[i].r;
ms[i+1].t=mr*ms[i].t+mt;
}
char*wp=wbuf;
long q=rd();
for(long j=0;j<q;++j){
long s=rd(),t=rd();
double x=rdf(),y=rdf();
C mr=ms[t].r/ms[s-1].r;
C mt=mr*-ms[s-1].t+ms[t].t;
C r=mr*(x+y*1j)+mt;
wtf(__real__ r);
*wp++=' ';
wtf(__imag__ r);
*wp++='\n';
}
write(1,wbuf,wp-wbuf);
_exit(0);
}
tails