Submission #133282

#TimeUsernameProblemLanguageResultExecution timeMemory
133282osaaateiasavtnlBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
298 ms159048 KiB
#include<bits/stdc++.h> using namespace std; #define int long long const int N = 3001; char a[N][N]; vector <char> al = {'J', 'O', 'I'}; int get(char c) { for (int i = 0; i < 3; ++i) { if (al[i] == c) return i; } } int row[N][N], col[N][N]; signed main() { #ifdef HOME freopen("input.txt", "r", stdin); #else ios_base::sync_with_stdio(0); cin.tie(0); #endif int n, m; cin >> n >> m; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { cin >> a[i][j]; } } int ans = 0; for (int i = n - 1; i >= 0; --i) { for (int j = m - 1; j >= 0; --j) { row[i][j] = row[i][j + 1] + (a[i][j] == 'O'); col[i][j] = col[i + 1][j] + (a[i][j] == 'I'); if (a[i][j] == 'J') { ans += row[i][j] * col[i][j]; } } } cout << ans << '\n'; }

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'long long int get(char)':
joi2019_ho_t1.cpp:11:1: warning: control reaches end of non-void function [-Wreturn-type]
 }   
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...