#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 index indexx
#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();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |