Submission #1204961

#TimeUsernameProblemLanguageResultExecution timeMemory
1204961minhpkBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
62 ms15652 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int a,b; char z[5005][5005]; int cot[1000005]; int ans=0; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> a >> b; for (int i=1;i<=a;i++){ string s; cin >> s; for (int j=0;j<b;j++){ z[i][j+1]=s[j]; } } for (int i=1;i<=a;i++){ int prefix=0; for (int j=b;j>=1;j--){ if (z[i][j]=='I'){ ans+=cot[j]; }else if (z[i][j]=='J'){ cot[j]+=prefix; }else{ prefix++; } } } cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...