Submission #574615

#TimeUsernameProblemLanguageResultExecution timeMemory
574615tekiBitaro the Brave (JOI19_ho_t1)C++11
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> typedef long long ll; #define pb push_back #define MS(x,y) memset((x),(y),sizeof((x))) #define MN 1000000007 using namespace std; char mat[3001][3001]; int oDesno[3001][3001]; int iDole[3001][3001]; int getO (int i, int j) { if (j != 0) return oDesno[i][j-1]; else return 0; } int getI (int i, int j) { if (i != 0) return iDole[i-1][j]; else return 0; } int main() { #if LOCAL_DEBUG fstream cin("in.txt"); #endif ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n,m; cin>>n>>m; for (int i = 0; i<n; i++) { for (int j = 0; j<m; j++) { cin>>mat[i][j]; oDesno[i][j] = (mat[i][j] == 'O') + getO(i,j); iDole[i][j] = (mat[i][j] == 'I') + getI(i,j); } } int res = 0; for (int i = 0; i<n; i++) { for (int j = 0; j<m; j++) { if (mat[i][j] != 'J') continue; res += (oDesno[i][m-1]-oDesno[i][j]) * (iDole[n-1][j]-oDesno[i][j]); } } cout<<res<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...