# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1005644 | 2024-06-22T17:10:43 Z | MarwenElarbi | Bitaro the Brave (JOI19_ho_t1) | C++17 | 11 ms | 344 KB |
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define fi first #define se second #define ll long long #define pb push_back #define ii pair<int,int> template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; const int nax=2e3+5; #define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif optimise; int n,m; cin>>n>>m; char grid[n][m]; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { cin>>grid[i][j]; } } long long ans=0; int xx[n][m]; int yy[n][m]; for (int i = 0; i < n; ++i) { int cur=0; for (int j = m-1; j >= 0; --j) { if(grid[i][j]=='O') cur++; xx[i][j]=cur; } } for (int j = 0; j < m; ++j) { int cur=0; for (int i = n-1; i >= 0; --i) { if(grid[i][j]=='I') cur++; yy[i][j]=cur; } } for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { if(grid[i][j]=='J'){ ans+=yy[i][j]*xx[i][j]; } } } cout <<ans<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |