test/DSL_2_B.test.cpp
Depends on
Code
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/2/DSL_2_B"
#include <data_structure/dynamic_segment_tree.hpp> // for DynamicSegmentTree
#include <fastio/base.hpp> // for FASTIO, cin, cout
#include <fastio/char/write.hpp> // for operator<<
#include <fastio/signed/read.hpp> // for operator>>
#include <fastio/signed/write.hpp> // for operator<<
#include <templates/macro/abbrev/endl.hpp> // for endl
#include <templates/macro/segtree/RSQ.hpp> // for RSQ
#include <templates/rep.hpp> // for rep
#include <templates/template.hpp>
#include <version> // for std
using namespace std;
int main() {
int n, q;
cin >> n >> q;
DynamicSegmentTree<RSQ(int, 0)> seg;
rep(_, q) {
int T, x, y;
cin >> T >> x >> y;
if (T) {
cout << seg(x, y + 1) << endl;
} else {
seg.add(x, y);
}
}
}
#line 1 "test/DSL_2_B.test.cpp"
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/2/DSL_2_B"
#include <data_structure/dynamic_segment_tree.hpp> // for DynamicSegmentTree
#include <fastio/base.hpp> // for FASTIO, cin, cout
#include <fastio/char/write.hpp> // for operator<<
#include <fastio/signed/read.hpp> // for operator>>
#include <fastio/signed/write.hpp> // for operator<<
#include <templates/macro/abbrev/endl.hpp> // for endl
#include <templates/macro/segtree/RSQ.hpp> // for RSQ
#include <templates/rep.hpp> // for rep
#include <templates/template.hpp>
#include <version> // for std
using namespace std;
int main() {
int n, q;
cin >> n >> q;
DynamicSegmentTree<RSQ(int, 0)> seg;
rep(_, q) {
int T, x, y;
cin >> T >> x >> y;
if (T) {
cout << seg(x, y + 1) << endl;
} else {
seg.add(x, y);
}
}
}
Test cases
Env |
Name |
Status |
Elapsed |
Memory |
g++ |
00_small_00.in |
AC |
7 ms |
4 MB |
g++ |
00_small_01.in |
AC |
5 ms |
4 MB |
g++ |
00_small_02.in |
AC |
5 ms |
4 MB |
g++ |
00_small_03.in |
AC |
4 ms |
4 MB |
g++ |
01_rand_00.in |
AC |
5 ms |
4 MB |
g++ |
01_rand_01.in |
AC |
4 ms |
4 MB |
g++ |
01_rand_02.in |
AC |
5 ms |
4 MB |
g++ |
01_rand_03.in |
AC |
5 ms |
4 MB |
g++ |
02_slight_00.in |
AC |
4 ms |
4 MB |
g++ |
02_slight_01.in |
AC |
6 ms |
4 MB |
g++ |
02_slight_02.in |
AC |
12 ms |
4 MB |
g++ |
02_slight_03.in |
AC |
89 ms |
4 MB |
g++ |
03_biased_00.in |
AC |
10 ms |
4 MB |
g++ |
03_biased_01.in |
AC |
229 ms |
6 MB |
g++ |
03_biased_02.in |
AC |
229 ms |
6 MB |
g++ |
03_biased_03.in |
AC |
515 ms |
8 MB |
g++ |
04_maximum_00.in |
AC |
446 ms |
7 MB |
g++ |
04_maximum_01.in |
AC |
445 ms |
7 MB |
g++ |
04_maximum_02.in |
AC |
446 ms |
7 MB |
g++ |
04_maximum_03.in |
AC |
445 ms |
7 MB |
Back to top page