結果

問題 No.1932 動く点 P / Moving Point P
ユーザー tailstails
提出日時 2022-05-10 21:03:30
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 33 ms / 6,000 ms
コード長 1,456 bytes
コンパイル時間 1,298 ms
コンパイル使用メモリ 34,448 KB
実行使用メモリ 13,804 KB
最終ジャッジ日時 2023-09-25 04:27:06
合計ジャッジ時間 18,606 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,388 KB
testcase_01 AC 13 ms
7,636 KB
testcase_02 AC 10 ms
6,496 KB
testcase_03 AC 9 ms
5,544 KB
testcase_04 AC 12 ms
6,856 KB
testcase_05 AC 13 ms
8,068 KB
testcase_06 AC 5 ms
4,992 KB
testcase_07 AC 33 ms
13,804 KB
testcase_08 AC 31 ms
13,660 KB
testcase_09 AC 22 ms
13,276 KB
testcase_10 AC 23 ms
13,584 KB
testcase_11 AC 22 ms
13,412 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:5:26: 警告: 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:49:26: 備考: in expansion of macro ‘rdf’
   49 |                 double p=rdf(),q=rdf(),r=rdf();
      |                          ^~~
main.c:5:26: 備考: (‘p’ 用の初期化付近)
    5 | #define rdf() ({long neg=*rp=='-'?++rp:0,a=rd(),b=rd();(neg?-1:1)*(a+b*1e-6);})
      |                          ^
main.c:49:26: 備考: in expansion of macro ‘rdf’
   49 |                 double p=rdf(),q=rdf(),r=rdf();
      |                          ^~~
main.c:5:26: 警告: 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:49:34: 備考: in expansion of macro ‘rdf’
   49 |                 double p=rdf(),q=rdf(),r=rdf();
      |                                  ^~~
main.c:5:26: 備考: (‘q’ 用の初期化付近)
    5 | #define rdf() ({long neg=*rp=='-'?++rp:0,a=rd(),b=rd();(neg?-1:1)*(a+b*1e-6);})
      |                          ^
main.c:49:34: 備考: in expansion of macro ‘rdf’
   49 |                 double p=rdf(),q=rdf(),r=rdf();
      |                                  ^~~
main.c:5:26: 警告: 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:49:42: 備考: in expansion of macro ‘rdf’
   49 |                 double p=rdf(),q=rdf(),r=rdf();
      |                                          ^~~
main.c:5:26: 備考: (‘r’ 用の初期化付近)
    5 | #define rdf() ({long 

ソースコード

diff #

#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;})
#define rep(v,e) for(long v=0;v<e;++v)
#define PI 3.14159265358979

typedef unsigned long ulong;
char wbuf[1<<25];

typedef struct M{
	double c,s,x,y;
}M;

static M compose(M a,M b){
	M r;
	r.c=b.c*a.c-b.s*a.s;
	r.s=b.s*a.c+b.c*a.s;
	r.x=a.c*b.x-a.s*b.y+a.x;
	r.y=a.s*b.x+a.c*b.y+a.y;
	return r;
}

static M invert(M a){
	M r;
	r.c=a.c;
	r.s=-a.s;
	r.x=-a.c*a.x-a.s*a.y;
	r.y= a.s*a.x-a.c*a.y;
	return r;
}

M ms[100001];

int main(){
	char*mmap();
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);

	long n=rd();
	ms[0].c=1;
	ms[0].s=0;
	ms[0].x=0;
	ms[0].y=0;
	rep(i,n){
		double p=rdf(),q=rdf(),r=rdf();
		double c,s;
		sincos(PI/180*r,&s,&c);
		M m;
		m.c=c;
		m.s=s;
		m.x=(1-c)*p+s*q;
		m.y=-s*p+(1-c)*q;
		ms[i+1]=compose(m,ms[i]);
	}

	char*wp=wbuf;
	long q=rd();
	rep(j,q){
		long s=rd(),t=rd();
		double x=rdf(),y=rdf();
		M m=compose(ms[t],invert(ms[s-1]));
		wtf(m.c*x-m.s*y+m.x);
		*wp++=' ';
		wtf(m.s*x+m.c*y+m.y);
		*wp++='\n';
	}
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0