Submission #1093672

#TimeUsernameProblemLanguageResultExecution timeMemory
1093672lamagrilBitaro the Brave (JOI19_ho_t1)C++14
50 / 100
1102 ms104528 KiB
#include <bits/stdc++.h> #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #define int long long using namespace std; const int nx=3005; char mp[nx][nx]; int32_t main(){ cin.tie(NULL)->sync_with_stdio(false); int n,m; cin >> n >> m; for(int i=1 ; i<=n ; i++){ string s; cin >> s; for(int j=1 ; j<=m ; j++){ mp[i][j]=s[j-1]; } } vector<int> aj[nx],ao[nx],ai[nx]; for(int i=1 ; i<=n ; i++){ for(int j=1 ; j<=m ; j++){ if(mp[i][j]=='J'){ aj[i].push_back(j); } else if(mp[i][j]=='O'){ ao[j].push_back(i); } else if(mp[i][j]=='I'){ ai[j].push_back(i); } } } int ans=0; for(int l=1 ; l<=m ; l++)/*loop l*/{ for(int i:ao[l])/*loop i*/{ for(int j:aj[i])/*loop j*/{ if(j>=l) continue; for(int k:ai[j])/*loop k*/{ if(k<=i) continue; ans++; } } } } /* i j k l i<k j<l */ cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...