Submission #818794

#TimeUsernameProblemLanguageResultExecution timeMemory
818794vjudge1Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
691 ms10488 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define el cout<<endl; #define fr(n,m) for(int i=n;i<m;i++) #define frj(n,m) for(int j=n;j<m;j++) #define frl(n,m) for(int l=n;l<m;l++) #define frd(n,m) for(int d=n;d<m;d++) #define mii map<int,int> #define mci map<char,int> #define vi vector<int> #define vc vector<char> #define mivi map<int,vi> const int mod = 1e9 + 7; // const int mod=998 int i = 0, j = 0, k = 0, l = 0, h = 0, w = 0, a = 0, b = 0, c = 0, d = 0; int num = 0, ans = 0, sum = 0; const int N = 1e3 + 5; void solve() { cin >> h >> w; vector<string>v(h); mii mi; mii mo; fr(0, h) { cin >> v[i]; frj(0, w) { if (v[i][j] == 'I') { mi[j]++; } else if (v[i][j] == 'O') { mo[i]++; } } } fr(0, h) { frj(0, w) { if (v[i][j] == 'J') { ans += mi[j] * mo[i]; } else if (v[i][j] == 'I') { mi[j]--; } else { mo[i]--; } } } cout << ans; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int T = 1; // cin >> T; while (T--) { cout << fixed << setprecision(12); solve(); el; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...