Submission #110418

#TimeUsernameProblemLanguageResultExecution timeMemory
110418saidBitaro the Brave (JOI19_ho_t1)C++14
20 / 100
12 ms6656 KiB
#include <iostream> using namespace std; #define MAX 3010 string s[MAX]; int h, w, v1[MAX][MAX], v2[MAX][MAX]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> h >> w; for(int i = 0; i < h; i++) cin >> s[i]; int qt = 0; for(int j = 0; j < w; j++){ qt = 0; for(int i = h-1; i >= 0; i--){ v1[i][j] += qt; if(s[i][j] == 'I'){ qt++; } } } for(int i = 0; i < h; i++){ qt = 0; for(int j = w-1; j >= 0; j--){ v2[i][j] += qt; if(s[i][j] == 'O'){ qt++; } } } int ans = 0; for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ if(s[i][j] == 'J'){ ans += v1[i][j]*v2[i][j]; } } } cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...