結果

問題 No.2961 Shiny Monster Master
コンテスト
ユーザー 👑 tails
提出日時 2024-11-25 16:03:00
言語 C90(gcc15)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 814 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 88 ms
コンパイル使用メモリ 26,584 KB
最終ジャッジ日時 2026-02-24 01:21:15
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function 'main':
main.c:9:32: error: expected ';' before '_'
    9 | #define repeat(e) for(typeof(e)_=e;_--;)
      |                                ^
main.c:18:9: note: in expansion of macro 'repeat'
   18 |         repeat(n){
      |         ^~~~~~
main.c:9:36: error: '_' undeclared (first use in this function)
    9 | #define repeat(e) for(typeof(e)_=e;_--;)
      |                                    ^
main.c:18:9: note: in expansion of macro 'repeat'
   18 |         repeat(n){
      |         ^~~~~~
main.c:9:36: note: each undeclared identifier is reported only once for each function it appears in
    9 | #define repeat(e) for(typeof(e)_=e;_--;)
      |                                    ^
main.c:18:9: note: in expansion of macro 'repeat'
   18 |         repeat(n){
      |         ^~~~~~
main.c:22:14: error: expected ';' before 'i'
   22 |         reps(i,1,R){
      |              ^
main.c:8:34: note: in definition of macro 'reps'
    8 | #define reps(v,s,e) for(typeof(e)v=s;v<e;++v)
      |                                  ^
main.c:22:14: error: 'i' undeclared (first use in this function)
   22 |         reps(i,1,R){
      |              ^
main.c:8:38: note: in definition of macro 'reps'
    8 | #define reps(v,s,e) for(typeof(e)v=s;v<e;++v)
      |                                      ^
main.c:9:32: error: expected ';' before '_'
    9 | #define repeat(e) for(typeof(e)_=e;_--;)
      |                                ^
main.c:27:9: note: in expansion of macro 'repeat'
   27 |         repeat(q){
      |         ^~~~~~

ソースコード

diff #
raw source code

#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 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 wt(v) if(v>=100000000){WTHI(v/10);*wp++=v%10+'0';}else{WTHI(v);}
#define reps(v,s,e) for(typeof(e)v=s;v<e;++v)
#define repeat(e) for(typeof(e)_=e;_--;)

char wbuf[1<<25];
int b[1000000];

int main(){
	rd_init();
	int R=rd();
	int n=rd();
	repeat(n){
		int a=rd();
		b[a]+=1;
	}
	reps(i,1,R){
		b[i]+=b[i-1];
	}
	int q=rd();
	char*wp=wbuf;
	repeat(q){
		int l=rd()-1;
		int r=rd();
		int v=b[r%R]+r/R*n;
		if(l>=0){
			v-=b[l%R]+l/R*n;
		}
		wt(v);
		*wp++='\n';
	}
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0