結果
| 問題 |
No.469 区間加算と一致検索の問題
|
| コンテスト | |
| ユーザー |
hirokazu1020
|
| 提出日時 | 2016-12-19 00:31:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,273 bytes |
| コンパイル時間 | 875 ms |
| コンパイル使用メモリ | 104,044 KB |
| 実行使用メモリ | 12,000 KB |
| 最終ジャッジ日時 | 2024-12-14 08:40:25 |
| 合計ジャッジ時間 | 4,610 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 WA * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:45:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
45 | scanf("%d%d", &n, &q);
| ~~~~~^~~~~~~~~~~~~~~~
main.cpp:54:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
54 | scanf(" %c", &c);
| ~~~~~^~~~~~~~~~~
main.cpp:60:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
60 | scanf("%d%d%d", &l, &r, &k);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#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