Skip to content

Instantly share code, notes, and snippets.

@yurahuna
Created September 22, 2016 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurahuna/854b226dddd49335108666fca4b609a5 to your computer and use it in GitHub Desktop.
Save yurahuna/854b226dddd49335108666fca4b609a5 to your computer and use it in GitHub Desktop.
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int W, H, T;
cin >> W >> H >> T;
int p;
cin >> p;
vvi a(H, vi(W));
rep(i, p) {
int c, r, t;
cin >> c >> r >> t;
a[r][c]++;
}
int ans = 0;
rep(i, H) {
rep(j, W) {
int b;
cin >> b;
ans += b * a[i][j];
}
}
cout << ans << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment