This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub beet-aizu/library
#define PROBLEM "https://judge.yosupo.jp/problem/associative_array" #include <bits/stdc++.h> using namespace std; #define call_from_test #include "../../tools/cc_hash.cpp" #include "../../datastructure/pb_ds_cc_hash_table.cpp" #undef call_from_test #ifdef SANITIZE #define IGNORE #endif signed main(){ cin.tie(0); ios::sync_with_stdio(0); const char newl = '\n'; using ll = long long; gmap<ll, ll, cc_hash<ll>> mp; int q; cin>>q; for(int i=0;i<q;i++){ int t; cin>>t; if(t==0){ ll k,v; cin>>k>>v; mp[k]=v; } if(t==1){ ll k; cin>>k; cout<<mp[k]<<newl; } } return 0; }
#line 1 "test/yosupo/associative_array.test.cpp" #define PROBLEM "https://judge.yosupo.jp/problem/associative_array" #include <bits/stdc++.h> using namespace std; #define call_from_test #line 1 "tools/cc_hash.cpp" #line 3 "tools/cc_hash.cpp" using namespace std; #endif //BEGIN CUT HERE template<typename T> struct cc_hash{ uint64_t operator()(T x) const{ uint64_t y(x); y += 0x9e3779b97f4a7c15; y = (y ^ (y >> 30)) * 0xbf58476d1ce4e5b9; y = (y ^ (y >> 27)) * 0x94d049bb133111eb; return y ^ (y >> 31); } }; //END CUT HERE #ifndef call_from_test signed main(){ return 0; } #endif #line 1 "datastructure/pb_ds_cc_hash_table.cpp" #line 3 "datastructure/pb_ds_cc_hash_table.cpp" using namespace std; #endif //BEGIN CUT HERE #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; template<typename T,typename U, typename H=hash<T> > using gmap = cc_hash_table<T, U, H>; //END CUT HERE #ifndef call_from_test //INSERT ABOVE HERE signed main(){ return 0; } #endif #line 9 "test/yosupo/associative_array.test.cpp" #undef call_from_test #ifdef SANITIZE #define IGNORE #endif signed main(){ cin.tie(0); ios::sync_with_stdio(0); const char newl = '\n'; using ll = long long; gmap<ll, ll, cc_hash<ll>> mp; int q; cin>>q; for(int i=0;i<q;i++){ int t; cin>>t; if(t==0){ ll k,v; cin>>k>>v; mp[k]=v; } if(t==1){ ll k; cin>>k; cout<<mp[k]<<newl; } } return 0; }