Submission #716191

#TimeUsernameProblemLanguageResultExecution timeMemory
716191shoryu386Bitaro the Brave (JOI19_ho_t1)C++17
50 / 100
197 ms274432 KiB
#include <bits/stdc++.h> using namespace std; #define int long long main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; char arr[n][m]; for (int x = n-1; x > -1; x--){ for (int y = 0; y < m; y++) cin >> arr[x][y]; } int OpsumHori[n][m], OpsumVert[n][m], IpsumHori[n][m], IpsumVert[n][m]; for (int x = 0; x < n; x++){ OpsumHori[x][m-1] = (arr[x][m-1] == 'O'); IpsumHori[x][m-1] = (arr[x][m-1] == 'I'); for (int y = m-2; y > -1; y--){ OpsumHori[x][y] = OpsumHori[x][y+1] + (arr[x][y] == 'O'); IpsumHori[x][y] = IpsumHori[x][y+1] + (arr[x][y] == 'I'); } } for (int y = 0; y < m; y++){ OpsumVert[0][y] = (arr[0][y] == 'O'); IpsumVert[0][y] = (arr[0][y] == 'I'); for (int x = 1; x < n; x++){ OpsumVert[x][y] = OpsumVert[x-1][y] + (arr[x][y] == 'O'); IpsumVert[x][y] = IpsumVert[x-1][y] + (arr[x][y] == 'I'); } } int ans = 0; for (int x = 0; x < n; x++){ for (int y = 0; y < m; y++){ if (arr[x][y] == 'J') ans += OpsumHori[x][y] * IpsumVert[x][y]; } } cout << ans; }

Compilation message (stderr)

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