test/associative_array.test.cpp
Depends on
Code
#define PROBLEM "https://judge.yosupo.jp/problem/associative_array"
#include <data_structure/hash_map.hpp> // for HashMap
#include <fastio/base.hpp> // for cin, FASTIO, cout
#include <fastio/char/write.hpp> // for operator<<
#include <fastio/signed/read.hpp> // for operator>>
#include <fastio/unsigned/read.hpp> // for operator>>
#include <fastio/unsigned/write.hpp> // for operator<<
#include <templates/macro/abbrev/endl.hpp> // for endl
#include <templates/macro/abbrev/ull.hpp> // for ull
#include <templates/rep.hpp> // for rep
#include <templates/template.hpp>
#include <version> // for std
using namespace std;
int main() {
int q;
cin >> q;
HashMap t;
rep(_, q) {
ull T, k;
cin >> T >> k;
if (T == 0) {
ull v;
cin >> v;
t[k] = v;
} else {
cout << t[k] << endl;
}
}
}
#line 1 "test/associative_array.test.cpp"
#define PROBLEM "https://judge.yosupo.jp/problem/associative_array"
#include <data_structure/hash_map.hpp> // for HashMap
#include <fastio/base.hpp> // for cin, FASTIO, cout
#include <fastio/char/write.hpp> // for operator<<
#include <fastio/signed/read.hpp> // for operator>>
#include <fastio/unsigned/read.hpp> // for operator>>
#include <fastio/unsigned/write.hpp> // for operator<<
#include <templates/macro/abbrev/endl.hpp> // for endl
#include <templates/macro/abbrev/ull.hpp> // for ull
#include <templates/rep.hpp> // for rep
#include <templates/template.hpp>
#include <version> // for std
using namespace std;
int main() {
int q;
cin >> q;
HashMap t;
rep(_, q) {
ull T, k;
cin >> T >> k;
if (T == 0) {
ull v;
cin >> v;
t[k] = v;
} else {
cout << t[k] << endl;
}
}
}
Test cases
Env |
Name |
Status |
Elapsed |
Memory |
g++ |
2_powers_00 |
AC |
147 ms |
81 MB |
g++ |
example_00 |
AC |
5 ms |
4 MB |
g++ |
many_0set_00 |
AC |
105 ms |
40 MB |
g++ |
many_0set_sparse_00 |
AC |
29 ms |
17 MB |
g++ |
max_many_updates_00 |
AC |
175 ms |
88 MB |
g++ |
max_random_00 |
AC |
110 ms |
44 MB |
g++ |
max_random_01 |
AC |
111 ms |
44 MB |
g++ |
max_random_02 |
AC |
130 ms |
53 MB |
g++ |
py_killer_00 |
AC |
117 ms |
44 MB |
g++ |
py_killer_01 |
AC |
111 ms |
44 MB |
g++ |
random_00 |
AC |
59 ms |
27 MB |
g++ |
random_01 |
AC |
64 ms |
28 MB |
g++ |
random_02 |
AC |
97 ms |
48 MB |
g++ |
sparse_keys_00 |
AC |
32 ms |
18 MB |
g++ |
sparse_keys_01 |
AC |
34 ms |
21 MB |
g++ |
unordered_map_killer_00 |
AC |
184 ms |
76 MB |
g++ |
unordered_map_killer_01 |
AC |
127 ms |
76 MB |
g++ |
unordered_map_killer_02 |
AC |
149 ms |
75 MB |
Back to top page