Submission #99711

#TimeUsernameProblemLanguageResultExecution timeMemory
99711MrTEKBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
262 ms9720 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int,int> ii; const int N = 3e3 + 5; int n,m,orb[N],ing[N]; char a[N][N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> m; for (int i = 1 ; i <= n ; i++) for (int j = 1 ; j <= m ; j++) { cin >> a[i][j]; if (a[i][j] == 'O') orb[i]++; if (a[i][j] == 'I') ing[j]++; } ll ans = 0; for (int i = 1 ; i <= n ; i++) for (int j = 1 ; j <= m ; j++) { if (a[i][j] == 'O') orb[i]--; if (a[i][j] == 'I') ing[j]--; if (a[i][j] == 'J') ans += orb[i] * ing[j]; } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...