File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
tests/library_checker_aizu_tests/handmade_tests Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ #define PROBLEM \
2+ " https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_A"
3+ #include " ../template.hpp"
4+ #include " ../../../library/contest/random.hpp"
5+ #include " ../../../library/data_structures_[l,r)/bit_uncommon/kd_bit.hpp"
6+ int main () {
7+ cin.tie (0 )->sync_with_stdio (0 );
8+ for (int num_tests = 0 ; num_tests < 100 ; num_tests++) {
9+ int n = rnd (1 , 100 );
10+ int m = rnd (1 , 100 );
11+ KD_BIT<2 > bit (n, m);
12+ vector<vector<ll>> a (n, vector<ll>(m, 0 ));
13+ for (int events = 0 ; events < 100 ; events++) {
14+ if (events % 2 == 0 ) {
15+ int i = rnd (0 , n - 1 );
16+ int j = rnd (0 , m - 1 );
17+ ll upd = rnd (INT_MIN, INT_MAX);
18+ a[i][j] += upd;
19+ bit.update (i, j, upd);
20+ } else {
21+ int i1 = rnd (0 , n);
22+ int j1 = rnd (0 , m);
23+ int i2 = rnd (0 , n);
24+ int j2 = rnd (0 , m);
25+ if (i1 > i2) swap (i1, i2);
26+ if (j1 > j2) swap (j1, j2);
27+ ll naive = 0 ;
28+ for (int i = i1; i < i2; i++)
29+ for (int j = j1; j < j2; j++) naive += a[i][j];
30+ assert (naive == bit.query (i1, i2, j1, j2));
31+ }
32+ }
33+ }
34+ cout << " Hello World\n " ;
35+ return 0 ;
36+ }
You can’t perform that action at this time.
0 commit comments