結果

問題 No.469 区間加算と一致検索の問題
ユーザー YamyukiYamyuki
提出日時 2016-12-21 10:14:10
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 3,142 ms / 5,000 ms
コード長 723 bytes
コンパイル時間 385 ms
コンパイル使用メモリ 24,644 KB
実行使用メモリ 11,152 KB
最終ジャッジ日時 2023-08-23 13:39:27
合計ジャッジ時間 50,061 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,700 KB
testcase_03 AC 9 ms
4,380 KB
testcase_04 AC 12 ms
4,376 KB
testcase_05 AC 16 ms
4,376 KB
testcase_06 AC 21 ms
4,380 KB
testcase_07 AC 24 ms
4,376 KB
testcase_08 AC 29 ms
4,376 KB
testcase_09 AC 6 ms
4,380 KB
testcase_10 AC 8 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 33 ms
4,380 KB
testcase_13 AC 12 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 4 ms
4,380 KB
testcase_16 AC 26 ms
4,380 KB
testcase_17 AC 20 ms
4,380 KB
testcase_18 AC 22 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 31 ms
4,380 KB
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 779 ms
4,380 KB
testcase_24 AC 783 ms
4,388 KB
testcase_25 AC 781 ms
4,388 KB
testcase_26 AC 774 ms
4,380 KB
testcase_27 AC 783 ms
4,376 KB
testcase_28 AC 786 ms
4,380 KB
testcase_29 AC 773 ms
4,388 KB
testcase_30 AC 781 ms
4,380 KB
testcase_31 AC 779 ms
4,380 KB
testcase_32 AC 778 ms
4,380 KB
testcase_33 AC 3,131 ms
11,148 KB
testcase_34 AC 3,142 ms
11,088 KB
testcase_35 AC 3,122 ms
11,044 KB
testcase_36 AC 3,129 ms
11,140 KB
testcase_37 AC 3,114 ms
11,152 KB
testcase_38 AC 1,951 ms
10,776 KB
testcase_39 AC 1,965 ms
10,668 KB
testcase_40 AC 1,964 ms
10,596 KB
testcase_41 AC 1,980 ms
10,660 KB
testcase_42 AC 1,959 ms
10,692 KB
testcase_43 AC 1,955 ms
10,776 KB
testcase_44 AC 1,966 ms
10,688 KB
testcase_45 AC 1,944 ms
10,644 KB
testcase_46 AC 1,953 ms
10,796 KB
testcase_47 AC 1,962 ms
10,692 KB
testcase_48 AC 1 ms
4,380 KB
testcase_49 AC 1 ms
4,380 KB
testcase_50 AC 1,969 ms
10,804 KB
testcase_51 AC 1,960 ms
10,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>

const unsigned long long mod=1000000007;
long long p[1000000];
long c;
typedef struct {
	long time;
	unsigned long long h;
} first;
first f[100000];

long search(){
	
}

int main(){
	long n,m,i,l,r,k;
	unsigned long long now=0;
	char query;
	scanf("%ld %ld",&n,&m);
	p[0]=1;
	for(i=0;i<n;i++){
		p[i+1]=p[i]*mod;
	}
	f[0].time=0;
	f[0].h=0;
	c=1;
	l=0;
	for(i=0;i<m;i++){
		getchar();
		scanf("%c",&query);
		if(query=='!'){ //add
			scanf("%ld %ld %ld",&l,&r,&k);
			now+=(unsigned long long)(p[r]-p[l])*k;
			for(l=0;l<c;l++){
				if(f[l].h==now) break;
			}
			if(c==l){
				f[c].time=i+1;
				f[c].h=now;
				c++;
			}
		}else{ // query=='?' question
			printf("%ld\n",f[l].time);
		}
	}
	return 0;
}
0