Submission #717582

#TimeUsernameProblemLanguageResultExecution timeMemory
717582vjudge1Bitaro the Brave (JOI19_ho_t1)C++11
0 / 100
1 ms212 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int #define inf 1e15 #define endl '\n'; using pii = pair<int,int>; using piii = pair<int,pii>; using piiii = pair<pii,pii>; int mod = 1e9+7; int32_t main() { //freopen("file.in" , "r" , stdin);freopen("file.out" , "w" , stdout); ios_base::sync_with_stdio(0);cin.tie(0); int H, W; cin >> H >> W; vector<vector<char>> grid(H, vector<char>(W)); for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) cin >> grid[i][j]; unordered_map<int, int> num_os; int cnt = 0; for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if (grid[i][j] == 'J') { for (int k = i + 1; k < H; k++) { if (grid[k][j] == 'I') { int key = (i * W) + j; cnt += ++num_os[key]; } if (grid[i][j] == 'J' && grid[k][j] == 'I') { int key = (i * W) + j; num_os[key]++; } } } } } cout << cnt << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...