Submission #717825

#TimeUsernameProblemLanguageResultExecution timeMemory
717825nninBitaro the Brave (JOI19_ho_t1)C++14
20 / 100
13 ms2552 KiB
#include<bits/stdc++.h> #define ll long long #define pii pair<int,int> #define f first #define s second using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int H, W; cin>>H>>W; vector<int> O[H]; vector<int> I[W]; vector<pii> J; for(int i=0;i<H;i++) { string s; cin>>s; for(int j=0;j<W;j++) { if(s[j]=='O') O[i].push_back(j); else if(s[j]=='I') I[j].push_back(i); else J.push_back({i, j}); } } int ans = 0; for(pii j:J) { int o = O[j.f].end()-upper_bound(O[j.f].begin(), O[j.f].end(), j.s); int i = I[j.s].end()-upper_bound(I[j.s].begin(), I[j.s].end(), j.f); ans += i*o; } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...