Submission #717547

#TimeUsernameProblemLanguageResultExecution timeMemory
717547vjudge1Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
570 ms82064 KiB
// Online C++ compiler to run C++ program online #include <bits/stdc++.h> using namespace std; char a[3005][3005]; pair<int,int> x[3005][3005]; int main() { // Write C++ code here int n, m; long long k = 0ll; cin >> n >> m; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ cin >> a[i][j]; } } for(int i = n; i; i--){ for(int j = m; j; j--){ x[i][j].first = x[i+1][j].first; x[i][j].second = x[i][j+1].second; if(a[i][j] == 'I')x[i][j].first++; if(a[i][j] == 'O')x[i][j].second++; if(a[i][j] == 'J')k += x[i][j].first * x[i][j].second; } } cout << k; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...