#include<bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define int long long
#define fi first
#define se second
#define pb push_back
#define hash hash1
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<ii, ii> iiii;
const int N = 2e5 + 5;
const int oo = 1e18 + 7, mod = 1e9 + 7;
const int hashy = 1e9 + 123;
/*
I think this is one of the easiest problems that you can give a guy if he knows segtree 2D
*/
// I think this will run as slow as f*ck, but it is sure O(1) lol
struct hash{
int operator()(const ii&a)const{
return (a.fi << 30) | a.se;
}
};
int n, a[N];
int cnt;
uint IT[N * 30 * 30];
unordered_map<ii, int, hash> index;
int cal(int x, int y){
if(index.find({x, y}) != index.end()) return index[{x, y}];
cnt++;
return index[{x, y}] = cnt;
}
void updy(int ind, int lx, int rx, int ly, int ry, int posy, int val){
if(ly == ry){
IT[ind] += val;
return;
}
int mid = (ly + ry) >> 1;
int temp1 = cal((lx << 30LL) + rx, (ly << 30LL) + mid), temp2 = cal((lx << 30LL) + rx, ((mid + 1) << 30LL) + ry);
if(posy <= mid) updy(temp1, lx, rx, ly, mid, posy, val);
else updy(temp2, lx, rx, mid + 1, ry, posy, val);
IT[ind] = IT[temp1] + IT[temp2];
}
void updx(int id, int lx, int rx, int posx, int val){
//int tmp = cal(lx, rx, 1, (1LL << 30), posx, po)
//updy()
}
void process(){
}
signed main(){
ios_base::sync_with_stdio(0);
process();
}
Compilation message
examination.cpp:39:30: error: 'std::unordered_map<std::pair<long long int, long long int>, long long int, hash1> index' redeclared as different kind of entity
39 | unordered_map<ii, int, hash> index;
| ^~~~~
In file included from /usr/include/string.h:432,
from /usr/include/c++/10/cstring:42,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:48,
from examination.cpp:1:
/usr/include/strings.h:61:1: note: previous declaration 'const char* index(const char*, int)'
61 | index (const char *__s, int __c) __THROW
| ^~~~~
examination.cpp: In function 'long long int cal(long long int, long long int)':
examination.cpp:42:11: error: overloaded function with no contextual type information
42 | if(index.find({x, y}) != index.end()) return index[{x, y}];
| ^~~~
examination.cpp:42:33: error: overloaded function with no contextual type information
42 | if(index.find({x, y}) != index.end()) return index[{x, y}];
| ^~~
examination.cpp:42:52: error: invalid types '<unresolved overloaded function type>[<brace-enclosed initializer list>]' for array subscript
42 | if(index.find({x, y}) != index.end()) return index[{x, y}];
| ^
examination.cpp:44:14: error: invalid types '<unresolved overloaded function type>[<brace-enclosed initializer list>]' for array subscript
44 | return index[{x, y}] = cnt;
| ^