Created
September 22, 2016 05:20
-
-
Save yurahuna/854b226dddd49335108666fca4b609a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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