Submission #839701

#TimeUsernameProblemLanguageResultExecution timeMemory
839701ipslpBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
231 ms53240 KiB
#include <iostream> using namespace std; int n, m; const int max_dim = 3*1e3 + 5; char v[max_dim][max_dim]; int s[max_dim][max_dim]; int main() { ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); cin >> n >> m; for( int i = 1; i <= n; ++i ) { for( int j = 1; j <= m; ++j ) { cin >> v[i][j]; } } for( int i = 1; i <= n; ++i ) { int O = 0; for( int j = m; j >= 1; --j ) { if( v[i][j] == 'O' ) ++O; if( v[i][j] == 'J' ) { s[i][j] = O; } } } long long cnt = 0; for( int j = 1; j <= m; ++j ) { int J = 0; for( int i = 1; i <= n; ++i ) { if( v[i][j] == 'J' ) J+=s[i][j]; if( v[i][j] == 'I' ) { //++I; //cout << 1 << " " << J << "\n"; cnt += J; } } } cout << cnt; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...