Submission #110425

#TimeUsernameProblemLanguageResultExecution timeMemory
110425saidBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
436 ms155832 KiB
#include <iostream> using namespace std; #define int long long #define MAX 3100 string s[MAX]; int h, w, v1[MAX][MAX], v2[MAX][MAX]; 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; }

Compilation message (stderr)

joi2019_ho_t1.cpp:11:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...