結果

問題 No.469 区間加算と一致検索の問題
ユーザー PulmnPulmn
提出日時 2018-07-16 17:55:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 172 ms / 5,000 ms
コード長 1,047 bytes
コンパイル時間 3,558 ms
コンパイル使用メモリ 153,544 KB
実行使用メモリ 17,020 KB
最終ジャッジ日時 2023-08-11 06:50:32
合計ジャッジ時間 7,696 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
11,180 KB
testcase_01 AC 10 ms
11,188 KB
testcase_02 AC 10 ms
11,204 KB
testcase_03 AC 14 ms
11,584 KB
testcase_04 AC 15 ms
11,348 KB
testcase_05 AC 16 ms
11,540 KB
testcase_06 AC 17 ms
11,628 KB
testcase_07 AC 18 ms
11,644 KB
testcase_08 AC 19 ms
11,692 KB
testcase_09 AC 13 ms
11,328 KB
testcase_10 AC 17 ms
11,396 KB
testcase_11 AC 12 ms
11,388 KB
testcase_12 AC 19 ms
11,792 KB
testcase_13 AC 16 ms
11,384 KB
testcase_14 AC 11 ms
11,408 KB
testcase_15 AC 13 ms
11,528 KB
testcase_16 AC 18 ms
11,600 KB
testcase_17 AC 18 ms
11,772 KB
testcase_18 AC 17 ms
11,572 KB
testcase_19 AC 11 ms
11,396 KB
testcase_20 AC 19 ms
11,708 KB
testcase_21 AC 12 ms
11,180 KB
testcase_22 AC 10 ms
11,228 KB
testcase_23 AC 71 ms
14,056 KB
testcase_24 AC 73 ms
13,960 KB
testcase_25 AC 72 ms
13,860 KB
testcase_26 AC 71 ms
13,868 KB
testcase_27 AC 75 ms
14,176 KB
testcase_28 AC 71 ms
13,984 KB
testcase_29 AC 72 ms
13,868 KB
testcase_30 AC 72 ms
14,092 KB
testcase_31 AC 74 ms
13,972 KB
testcase_32 AC 75 ms
13,936 KB
testcase_33 AC 170 ms
16,744 KB
testcase_34 AC 170 ms
16,644 KB
testcase_35 AC 172 ms
17,020 KB
testcase_36 AC 170 ms
16,744 KB
testcase_37 AC 170 ms
16,780 KB
testcase_38 AC 151 ms
15,440 KB
testcase_39 AC 153 ms
15,368 KB
testcase_40 AC 152 ms
15,392 KB
testcase_41 AC 149 ms
15,276 KB
testcase_42 AC 149 ms
15,356 KB
testcase_43 AC 146 ms
15,516 KB
testcase_44 AC 151 ms
15,380 KB
testcase_45 AC 155 ms
15,356 KB
testcase_46 AC 154 ms
15,324 KB
testcase_47 AC 151 ms
15,336 KB
testcase_48 AC 10 ms
11,152 KB
testcase_49 AC 10 ms
11,156 KB
testcase_50 AC 153 ms
15,464 KB
testcase_51 AC 161 ms
15,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ull mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

const int M=1000005;
int n,q;
ull a[M];

int main(){
	cin>>n>>q;
	ull H=0;
	a[1]=1;
	map<ull,int> m;
	m[0]=0;
	vi b;
	for(int i=2;i<M;i++) a[i]=a[i-1]*mod;
	for(int i=1;i<M;i++) a[i]+=a[i-1];
	for(int i=0;i<q;i++){
		char c;
		cin>>c;
		if(c=='!'){
			ull l,r,k;
			cin>>l>>r>>k;
			H+=(a[r]-a[l])*k;
			if(m.find(H)==m.end()) m[H]=i+1;
		}
		else cout<<m[H]<<endl;
	}
}
0