제출 #1265458

#제출 시각아이디문제언어결과실행 시간메모리
1265458trinm01Bitaro the Brave (JOI19_ho_t1)C++20
100 / 100
276 ms150520 KiB
// #pragma GCC optimize("O3") // #pragma GCC optimization("Ofast,unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define FOR(i, l, r) for (int i = (l); i <= (r); i++) #define FOD(i, r, l) for (int i = (r); i >= (l); i--) #define fi first #define se second #define pii pair<int, int> const ll mod = 1e9 + 7; const int MAXN = 3e3 + 5; const ll oo = 1e18+7; const int base = 0; int m, n; char a[MAXN][MAXN]; int O[MAXN][MAXN], I[MAXN][MAXN]; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); // freopen("test.txt", "r", stdin); // freopen("o2.out", "w", stdout); // if(fopen(".inp", "r")){ // freopen(".inp", "r", stdin); // freopen(".out", "w", stdout); // } cin >> m >> n; FOR(i, 1, m){ string s; cin >> s; FOR(j, 1, n){ a[i][j]=s[j-1]; } } FOR(i, 1, m){ FOR(j, 1, n){ O[i][j]=O[i][j-1]; if(a[i][j]=='O'){ O[i][j]++; } } } FOR(j, 1, n){ FOR(i, 1, m){ I[i][j]=I[i-1][j]; if(a[i][j]=='I'){ I[i][j]++; } } } int ans=0; FOR(i, 1, m){ FOR(j, 1, n){ if(a[i][j]=='J'){ ans+=(O[i][n]-O[i][j-1])*(I[m][j]-I[i-1][j]); } } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...