結果

問題 No.2359 A in S ?
ユーザー tailstails
提出日時 2023-06-24 03:25:30
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 995 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 29,340 KB
実行使用メモリ 130,400 KB
最終ジャッジ日時 2023-09-13 22:41:41
合計ジャッジ時間 4,812 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
126,960 KB
testcase_01 AC 143 ms
126,952 KB
testcase_02 AC 135 ms
127,056 KB
testcase_03 AC 137 ms
126,916 KB
testcase_04 AC 140 ms
129,404 KB
testcase_05 AC 56 ms
130,000 KB
testcase_06 AC 141 ms
129,260 KB
testcase_07 AC 142 ms
130,400 KB
testcase_08 AC 58 ms
129,548 KB
testcase_09 AC 142 ms
129,536 KB
testcase_10 AC 48 ms
129,420 KB
testcase_11 AC 48 ms
129,848 KB
testcase_12 AC 143 ms
129,488 KB
testcase_13 AC 144 ms
129,376 KB
testcase_14 AC 144 ms
129,252 KB
testcase_15 AC 139 ms
129,256 KB
testcase_16 AC 143 ms
129,312 KB
testcase_17 AC 143 ms
129,224 KB
testcase_18 AC 151 ms
129,252 KB
testcase_19 AC 142 ms
129,192 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:48:2: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
  write(1,wbuf,wp-wbuf);
  ^~~~~
main.c:49:2: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
  _exit(0);
  ^~~~~
main.c:49:2: warning: incompatible implicit declaration of built-in function ‘_exit’

ソースコード

diff #

#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() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define wt(v) ({unsigned _z=v,_n=0;ulong _d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(ulong*)wp=_d;wp+=_n;})
#define rep(v,e) for(typeof(e) v=0;v<e;++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)

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

int d[320][100400];

int main(){
	rd_init();
	int n=rd();
	rd_skip();
	rep(j,n){
		int l=rd()-1;
		int r=rd();
		int x=rd();
		int y=rd();
		l+=x-(l-y+x)%x;
		r+=x-(r-y+x)%x;
		if(x<320){
			d[x][l]+=1;
			d[x][r]-=1;
		}else{
			rep4(i,l,r,x){
				d[0][i]+=1;
			}
		}
	}
	rep3(x,1,320){
		rep(i,100001){
			d[0][i]+=d[x][i]+=i-x<0?0:d[x][i-x];
		}
	}
	char*wp=wbuf;
	while(*rp){
		int a=rd();
		wt(d[0][a]);
		*wp++='\n';
	}
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0