効果の対象に
\([I] [J ] \) のものを入れて内側に、あなたも何かを奪うことができ、その後、クエリ([I] [J \ ] \) それが何であるかを内部。
アイデア:
もちろん、私たちは暴力をすることができますが、大きさの配列を開くことができません。
その説明dalao圧延、なぜそれを構造化する必要がありますか??
ダイレクト(地図\)\?彼は香りではありません、まだ
我々は使用\(マップ<int型、int型>ミリアンペアを[N]; \) 行うには暴力の配列として。
以来(マップ\)\あなたがスペースを訪問していない場合はSTLは当てはまらないとして、その後、我々はできます彼らが欲しいものは何でもこの問題のうち。
コード:
#include <bits/stdc++.h>
#define N 100010
#define M 1010
using namespace std;
int n, q;
map<int, int>ma[N];
int read() {
int s = 0, f = 0; char ch = getchar();
while (!isdigit(ch)) f |= (ch == '-'), ch = getchar();
while (isdigit(ch)) s = s * 10 + (ch ^ 48), ch = getchar();
return f ? -s : s;
}
int main() {
n = read(), q = read();
for (int i = 1, opt, x, y, sy; i <= q; i++) {
opt = read(), x = read(), y = read();
if (opt == 1) {
sy = read();
ma[x][y] = sy;
} else printf("%d\n", ma[x][y]);
}
return 0;
}