結果

問題 No.1043 直列大学
ユーザー tails
提出日時 2022-11-16 22:24:26
言語 C90
(gcc 12.3.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,062 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 27,136 KB
最終ジャッジ日時 2025-02-19 02:15:27
合計ジャッジ時間 801 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function 'main':
main.c:6:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    6 | #define rep(v,e) for(int v=0;v<e;++v)
      |                  ^~~
main.c:24:9: note: in expansion of macro 'rep'
   24 |         rep(i,n){
      |         ^~~
main.c:6:18: note: use option '-std=c99', '-std=gnu99', '-std=c11' or '-std=gnu11' to compile your code
    6 | #define rep(v,e) for(int v=0;v<e;++v)
      |                  ^~~
main.c:24:9: note: in expansion of macro 'rep'
   24 |         rep(i,n){
      |         ^~~
main.c:8:19: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    8 | #define rrep(v,e) for(int v=e;v--;)
      |                   ^~~
main.c:26:17: note: in expansion of macro 'rrep'
   26 |                 rrep(j,s){
      |                 ^~~~
main.c:6:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    6 | #define rep(v,e) for(int v=0;v<e;++v)
      |                  ^~~
main.c:34:17: note: in expansion of macro 'rep'
   34 |                 rep(i,s){
      |                 ^~~
main.c:41:13: error: redefinition of 'i'
   41 |         rep(i,m){
      |             ^
main.c:6:26: note: in definition of macro 'rep'
    6 | #define rep(v,e) for(int v=0;v<e;++v)
      |                          ^
main.c:24:13: note: previous definition of 'i' with type 'int'
   24 |         rep(i,n){
      |             ^
main.c:6:26: note: in definition of macro 'rep'
    6 | #define rep(v,e) for(int v=0;v<e;++v)
      |                          ^
main.c:6:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    6 | #define rep(v,e) for(int v=0;v<e;++v)
      |                  ^~~
main.c:41:9: note: in expansion of macro 'rep'
   41 |         rep(i,m){
      |         ^~~
main.c:8:19: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    8 | #define rrep(v,e) for(int v=e;v--;)
      |                   ^~~
main.c:43:17: note: 

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define wt(v) {unsigned _z=v;do*--wp=_z%10+48;while(_z/=10);}
#define rep(v,e) for(int v=0;v<e;++v)
#define rep3(v,s,e) for(int v=s;v<e;++v)
#define rrep(v,e) for(int v=e;v--;)
#define rrep3(v,s,e) for(int v=e;--v>=s;)
#define min(a,b) (a<=b?a:b)
#define MD 1000000007

int v[100001],r[100001];

int main(){
	char*mmap();
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	long n=rd();
	long m=rd();
	long s=1;
	long t=1;

	v[0]=1;
	rep(i,n){
		int a=rd();
		rrep(j,s){
			int x=v[j]+v[j+a];
			v[j+a]=x-(x<MD?0:MD);
		}
		s+=a;
	}
	{
		int x=0;
		rep(i,s){
			x+=v[i];
			v[i]=x-=x<MD?0:MD;
		}
	}

	r[0]=1;
	rep(i,m){
		int a=rd();
		rrep(j,t){
			int x=r[j]+r[j+a];
			r[j+a]=x-(x<MD?0:MD);
		}
		t+=a;
	}

	int a=rd();
	int b=rd();
	int l=-1;
	int h=0;
	int z=0;
	rep3(i,1,t){
		z=(z+(long)r[i]*(long)(v[h=min(h+b,s-1)]-v[(l=min(l+a,s-1))]+MD))%MD;
	}

	char wbuf[64],*wp=wbuf+sizeof wbuf;
	wt(z);
	write(1,wp,wbuf+sizeof wbuf-wp);
	_exit(0);
}
0