제출 #1190623

#제출 시각아이디문제언어결과실행 시간메모리
1190623ArdelionBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
104 ms80012 KiB
#include <bits/stdc++.h> //#pragma GCC optimize("Ofast") //#pragma GCC optimize("O3") //#pragma GCC target("avx2") using namespace std; //#define int long long #define ll long long #define X first #define Y second #define lc (id<<1) #define rc (lc|1) #define mid ((l+r+1)>>1) #define pb push_back #define lb lower_bound #define ub upper_bound #define mp make_pair #define sep ' ' #define endl "\n" #define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define FileIO freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #define all(x) x.begin(), x.end() #define ret(x) {cout << x << endl; return;} typedef pair<int, int> pii; typedef pair<ll , ll > pll; const int N = 3e3+13; const int LOG = 23; const int MOD = 1e9 + 7; //998244353; //1e9+9; const int INF = 1e9; //1e18; const int dx[4] = {1, -1, 0, 0}; const int dy[4] = {0, 0, 1, -1}; ll md(ll x) {x%=MOD; return (x < 0 ? x+MOD : x);} ll GCD(ll _a, ll _b) { return (!_b ? _a : GCD(_b, _a % _b)); } ll POW(ll _a, ll _b) { return !_b ? 1 : ((_b & 1 ? _a : 1) * POW(_a * _a % MOD, _b / 2)) % MOD;} ll ans; int n, m; int ps[N][N][2]; //0->column, 1->row char MAP[N][N]; void F() { cin >> n >> m; for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) { cin >> MAP[i][j]; } } for(int i = n; i >= 1; i --) { for(int j = m; j >= 1; j--) { ps[i][j][0] = ps[i+1][j][0] + (MAP[i][j] == 'I'); ps[i][j][1] = ps[i][j+1][1] + (MAP[i][j] == 'O'); ans += (MAP[i][j] == 'J') * ps[i][j][0] * ps[i][j][1]; } } ret(ans); } int32_t main() { migmig; //PREP(); int t=1; //cin >> t; while(t--) F(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...