結果
| 問題 | No.469 区間加算と一致検索の問題 |
| コンテスト | |
| ユーザー |
hirokazu1020
|
| 提出日時 | 2016-12-19 00:31:29 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,273 bytes |
| 記録 | |
| コンパイル時間 | 1,099 ms |
| コンパイル使用メモリ | 130,516 KB |
| 実行使用メモリ | 12,276 KB |
| 最終ジャッジ日時 | 2026-05-25 02:47:40 |
| 合計ジャッジ時間 | 3,758 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 WA * 3 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())
unsigned int xor128() {
static unsigned int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
unsigned int t = (x ^ (x << 11));
x = y; y = z; z = w;
return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
}
unsigned int rhash[1000001];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, q;
scanf("%d%d", &n, &q);
for (int i = 1; i <= n; i++) {
rhash[i] = rhash[i - 1] + xor128();
}
unsigned int cur = 0;
unordered_map<int, int> mp;
mp[0] = 0;
rep(i,q) {
char c;
scanf(" %c", &c);
if (c == '?') {
cout << mp[cur] << endl;
}
else {
int l, r, k;
scanf("%d%d%d", &l, &r, &k);
cur += k * (rhash[r] - rhash[l]);
auto it = mp.emplace(cur, i + 1);
}
}
return 0;
}
hirokazu1020