Submission #950909

#TimeUsernameProblemLanguageResultExecution timeMemory
950909starBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
246 ms207664 KiB
#include <bits/stdc++.h> using namespace std; #define N 3005 #define LL long long #define pii pair<LL,LL> LL h, w, ans; char c; LL o[N][N], i[N][N]; vector<pii> j; int main() { ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); cin >> h >> w; for (int x=1; x<=h; x++) for (int y=1; y<=w; y++) { cin >> c; if (c=='J') j.push_back({x,y}); o[x][y]=o[x][y-1]+(c=='O'); i[x][y]=i[x-1][y]+(c=='I'); } ans=0; for (auto now:j) { int a=now.first, b=now.second; ans+=(o[a][w]-o[a][b])*(i[h][b]-i[a][b]); } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...