Submission #670295

#TimeUsernameProblemLanguageResultExecution timeMemory
670295dozerBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
305 ms220888 KiB
#include <bits/stdc++.h> using namespace std; #define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout) #define fastio() cin.tie(0), ios_base::sync_with_stdio(0) #define pb push_back #define pii pair<int, int> #define st first #define nd second #define endl "\n" #define sp " " #define N 3005 #define int long long int row[N][N], col[N][N], arr[N][N]; int32_t main() { fastio(); int h, w; cin>>h>>w; for (int i = 1; i <= h; i++) { for (int j = 1; j <= w; j++) { char tmp; cin>>tmp; col[i][j] = col[i][j - 1]; row[i][j] = row[i - 1][j]; if (tmp == 'J') arr[i][j] = 1; else if (tmp == 'O') arr[i][j] = 2, col[i][j]++; else arr[i][j] = 3, row[i][j]++; //cout<<row[i][j]<<sp; } //cout<<endl; } int ans = 0; for (int i = 1; i <= h; i++) { for (int j = 1; j <= w; j++) { if (arr[i][j] == 1) ans += (row[h][j] - row[i][j]) * (col[i][w] - col[i][j]); } } cout<<ans<<endl; cerr<<"time taken : "<<(float)clock() / CLOCKS_PER_SEC<<" seconds\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...