結果

問題 No.469 区間加算と一致検索の問題
ユーザー PulmnPulmn
提出日時 2018-07-16 17:54:59
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 164 ms / 5,000 ms
コード長 1,073 bytes
コンパイル時間 1,890 ms
コンパイル使用メモリ 154,244 KB
実行使用メモリ 16,844 KB
最終ジャッジ日時 2023-08-11 06:48:59
合計ジャッジ時間 7,422 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
11,236 KB
testcase_01 AC 10 ms
11,168 KB
testcase_02 AC 10 ms
11,144 KB
testcase_03 AC 14 ms
11,436 KB
testcase_04 AC 15 ms
11,484 KB
testcase_05 AC 15 ms
11,532 KB
testcase_06 AC 17 ms
11,608 KB
testcase_07 AC 17 ms
11,588 KB
testcase_08 AC 19 ms
11,632 KB
testcase_09 AC 13 ms
11,504 KB
testcase_10 AC 17 ms
11,200 KB
testcase_11 AC 11 ms
11,256 KB
testcase_12 AC 18 ms
11,676 KB
testcase_13 AC 15 ms
11,548 KB
testcase_14 AC 11 ms
11,248 KB
testcase_15 AC 12 ms
11,296 KB
testcase_16 AC 18 ms
11,604 KB
testcase_17 AC 17 ms
11,840 KB
testcase_18 AC 17 ms
11,612 KB
testcase_19 AC 11 ms
11,260 KB
testcase_20 AC 17 ms
11,700 KB
testcase_21 AC 11 ms
11,272 KB
testcase_22 AC 10 ms
11,272 KB
testcase_23 AC 70 ms
13,988 KB
testcase_24 AC 69 ms
13,924 KB
testcase_25 AC 71 ms
13,940 KB
testcase_26 AC 70 ms
13,972 KB
testcase_27 AC 70 ms
13,964 KB
testcase_28 AC 69 ms
14,104 KB
testcase_29 AC 68 ms
13,992 KB
testcase_30 AC 68 ms
13,932 KB
testcase_31 AC 70 ms
13,912 KB
testcase_32 AC 69 ms
14,120 KB
testcase_33 AC 158 ms
16,844 KB
testcase_34 AC 162 ms
16,744 KB
testcase_35 AC 164 ms
16,764 KB
testcase_36 AC 159 ms
16,728 KB
testcase_37 AC 158 ms
16,728 KB
testcase_38 AC 147 ms
15,348 KB
testcase_39 AC 148 ms
15,356 KB
testcase_40 AC 146 ms
15,492 KB
testcase_41 AC 147 ms
15,344 KB
testcase_42 AC 145 ms
15,368 KB
testcase_43 AC 146 ms
15,512 KB
testcase_44 AC 149 ms
15,340 KB
testcase_45 AC 147 ms
15,320 KB
testcase_46 AC 145 ms
15,488 KB
testcase_47 AC 152 ms
15,336 KB
testcase_48 AC 10 ms
11,140 KB
testcase_49 AC 10 ms
11,312 KB
testcase_50 AC 150 ms
15,328 KB
testcase_51 AC 148 ms
15,316 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 ll mod=1e9+7;
const ull mod=998244353;
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