Submit Info #65577

Problem Lang User Status Time Memory
Associative Array cpp MuheshKumar AC 778 ms 62.53 MiB

ケース詳細
Name Status Time Memory
2_powers_00 AC 540 ms 62.53 MiB
example_00 AC 1 ms 0.45 MiB
many_0set_00 AC 681 ms 25.04 MiB
many_0set_sparse_00 AC 120 ms 2.29 MiB
max_random_00 AC 713 ms 26.80 MiB
max_random_01 AC 736 ms 29.51 MiB
max_random_02 AC 778 ms 33.07 MiB
random_00 AC 257 ms 16.82 MiB
random_01 AC 315 ms 18.74 MiB
random_02 AC 456 ms 27.76 MiB
sparse_keys_00 AC 129 ms 3.87 MiB
sparse_keys_01 AC 151 ms 4.51 MiB
unordered_map_killer_00 AC 512 ms 62.41 MiB
unordered_map_killer_01 AC 509 ms 62.47 MiB
unordered_map_killer_02 AC 507 ms 62.41 MiB

#include <bits/stdc++.h> using namespace std; #define int long long #define vt vector #define ar array #define nl '\n' typedef long double ld; typedef pair<int, int> pi; typedef pair<ld, ld> pd; typedef vt<int> vi; typedef vt<ld> vd; typedef vt<pi> vpi; typedef vt<string> vs; typedef vt<vi> vvi; #define r_ep(i, a, b, s) for(int i = (a); (s) > 0 ? i < (b) : i > (b); i += (s)) #define rep1(e) r_ep(i, 0, e, 1) #define rep2(i, e) r_ep(i, 0, e, 1) #define rep3(i, b, e) r_ep(i, b, e, 1) #define rep4(i, b, e, s) r_ep(i, b, e, s) #define get5(a, b, c, d, e, ...) e #define repc(...) get5(__VA_ARGS__, rep4, rep3, rep2, rep1) #define rep(...) repc(__VA_ARGS__)(__VA_ARGS__) #define each(i, a) for (auto &i: a) #define all(x) (x).begin(), (x).end() #define amin(a, b) a = min(a, b) #define amax(a, b) a = max(a, b) #define sz(x) (int) (x).size() #define bg(x) (x).begin() #define lb lower_bound #define ub upper_bound #define pb push_back #define ppb pop_back #define mp make_pair #define mt make_tuple #define fr first #define sc second #define ft front() #define bk back() inline namespace IO { string to_string(char c) { return string(1, c); } string to_string(bool b) { return b ? "true" : "false"; } string to_string(const char * s) { return string(s); } string to_string(string s) { return s; } template<class T> string to_string(T x) { return std::to_string(x); } template<class A, class B> string to_string(pair<A, B> &a) { return to_string(a.fr) + " " + to_string(a.sc); } template<class T> void read(T &x) { cin >> x; } void read(float &d) { string t; read(t); d = stof(t); } void read(double &d) { string t; read(t); d = stod(t); } void read(ld &d) { string t; read(t); d = stold(t); } template<class A, class B> void read(pair<A, B> &a) { read(a.fr); read(a.sc); } template<class A> void read(vt<A> &a) { each(i, a) read(i); } template<class H, class... T> void read(H &h, T&... t) { read(h); read(t...); } template<class T> void write(T x) { cout << to_string(x); } template<class H, class... T> void write(const H &h, const T&... t) { write(h); write(t...); } void print() { write("\n"); } template<class T> void print(vt<T> x) { each(i, x) { write(i); write(" "); } print(); } template<class H, class... T> void print(const H &h, const T&... t) { write(h); if (sizeof...(t)) write(' '); print(t...); } } inline namespace Debug { mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); template <class T1, class T2> ostream &operator<< (ostream &os, const pair<T1,T2> &p) { os << '{' << p.first << ", " << p.second << '}'; return os; } template <typename C, typename T = std::decay_t<decltype(*begin(std::declval<C>()))>, typename std::enable_if<!std::is_same<C, std::string>::value>::type* = nullptr> ostream &operator<<(ostream &os, const C &container) { bool first = true; stringstream ss; ss << '['; for(const auto &x : container) { if (!first) { ss << ", "; } first = false; ss << x; } ss << ']'; return os << ss.str(); } #ifndef ONLINE_JUDGE #define debug(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << '\n'; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | "; __f(comma + 1, args...); } #else #define debug(...); #endif } inline namespace FileIO { void setIn(string s) { freopen(s.c_str(), "r", stdin); } void setOut(string s) { freopen(s.c_str(), "w", stdout); } void setIO(string s = "") { ios::sync_with_stdio(false); cin.tie(0); if (!s.empty()) setIn(s + ".in"), setOut(s + ".out"); } } const int MOD1 = 1e9 + 7; const int MOD2 = 998244353; const int MOD = MOD1; const int INF = 2e18; void solve() { int q; read(q); map<int, int> mp; rep(q) { int op; read(op); if (op == 0) { int k, v; read(k, v); mp[k] = v; } else { int k; read(k); print(mp[k]); } } } int32_t main() { setIO(); int tc = 1; // read(tc); rep(i, 1, tc + 1) { // write("Case #", i, ": "); solve(); } return 0; }