Submission #893508

#TimeUsernameProblemLanguageResultExecution timeMemory
893508MalixBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
384 ms18396 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int,int> pi; #define REP(i,a,b) for(int i=a;i<b;i++) #define F first #define S second #define PB push_back #define MP make_pair const int m=1e9+7; int main(){ //ios::sync_with_stdio(0); // cin.tie(0); //freopen("test_input.txt", "r", stdin); //freopen("test_output.txt", "w", stdout); int a,b;cin>>a>>b; vector<vector<char>> grid(a,vector<char>(b)); REP(i,0,a)REP(j,0,b)cin>>grid[i][j]; vi ic(b,0),oc(a,0); REP(i,0,a)REP(j,0,b){ if(grid[i][j]=='I')ic[j]++; else if(grid[i][j]=='O')oc[i]++; } ll ans=0; REP(i,0,a)REP(j,0,b){ if(grid[i][j]=='I')ic[j]--; else if(grid[i][j]=='O')oc[i]--; else ans+=(ll)oc[i]*ic[j]; } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...