Submission #465076

#TimeUsernameProblemLanguageResultExecution timeMemory
465076BarayBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
839 ms79872 KiB
#include <iostream> #include <vector> #include <set> #include <queue> #include <stack> #include <algorithm> #include <climits> #include <deque> using namespace std; #define ll long long ll n, m, ans; char matrix[3005][3005]; int main() { cin >> n >> m; int preRight[3005][3005] = {0}, preDown[3005][3005] = {0}; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> matrix[i][j]; } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { preRight[i][j] = preRight[i][j - 1]; if (matrix[i][j] == 'O') { preRight[i][j]++; } //cout << preRight[i][j] << " " << i << " | " << j << "\n"; } } for (int j = 1; j <= m; j++) { for (int i = 1; i <= n; i++) { preDown[i][j] = preDown[i - 1][j]; if (matrix[i][j] == 'I') { preDown[i][j]++; } //cout << preDown[i][j] << " " << i << " | " << j << "\n"; } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (matrix[i][j] == 'J') { ans += (preRight[i][m] - preRight[i][j]) * (preDown[n][j] - preDown[i][j]); } } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...