Submission #671054

#TimeUsernameProblemLanguageResultExecution timeMemory
671054mseebacherBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
244 ms17868 KiB
#include <stdio.h> #include <stdlib.h> #include <iostream> #include <string> #include <vector> #include <cmath> #include <cstring> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <stack> using namespace std; typedef long long ll; typedef vector<int> vi; #define MAXI (int) 1e6 ll a[MAXI]; ll si[MAXI]; ll r[MAXI]; ll maxi = 0; ll sum = 0; void solve(){ int h,w; cin >> h >> w; char mat[h][w]; vector<int> down(w,0); vector<int> right(h,0); for(int i = 0;i<h;i++){ for(int j =0;j<w;j++){ cin >> mat[i][j]; if(mat[i][j] == 'I') down[j]++; if(mat[i][j] == 'O') right[i]++; } } for(int i = 0;i<h;i++){ for(int j =0;j<w;j++){ if(mat[i][j] == 'I') down[j]--; if(mat[i][j] == 'O') right[i]--; if(mat[i][j] == 'J') sum += down[j]*right[i]; } } cout << sum; } int main(){ ios::sync_with_stdio(0); cin.tie(nullptr); cout << fixed << setprecision(8); int t = 1; //cin >> t; while(t){ solve(); t--; cout << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...