Submission #198767

#TimeUsernameProblemLanguageResultExecution timeMemory
198767DEDABitaro the Brave (JOI19_ho_t1)C++14
100 / 100
486 ms80096 KiB
/* _____ ____ _____ ___ ___ ___ ___ |_ _/ __ \_ _| |__ \ / _ \ |__ \ / _ \ | || | | || | ) | | | | ) | | | | | || | | || | / /| | | | / /| | | | _| || |__| || |_ / /_| |_| | / /_| |_| | |_____\____/_____| |____|\___/ |____|\___/ */ #include <bits/stdc++.h> #define rep(i, a, b) for (long long i = (a); i < (b); i++) #define per(i, a, b) for (long long i = (a); i > (b); i--) #define a(x) (x.begin(), x.end()) #define ar(x) (x.rbegin(), x.rend()) #define pb push_back #define Pb() pop_back() #define ll long long int #define ull unsigned long long int #define pii pair<int, int> #define pll pair<ll, ll> #define sc scanf #define scin(x) sc("%d", &(x)) #define scln(x) sc("%lld", &(x)) #define pf prllf #define ms(a, b) memset(a, b, sizeof(a)) #define mp make_pair #define db double #define EPS 10E-10 #define ff first #define ss second #define sqr(x) (x) * (x) #define vi vector<int> #define vl vector<ll> #define vii vector<vector<int>> #define vll vector<vector<ll>> #define DBG pf("HI\n") #define MOD 1000000007 #define CIN \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0) #define RUN_CASE(t, T) for (__typeof(t) t = 1; t <= T; t++) #define CASE(t) prllf("Case %d: ", t) #define CASEL(t) prllf("Case %d:\n", t) #define intlimit 2147483647 #define longlimit 9223372036854775807 #define infinity (1 << 28) #define gcd(a, b) __gcd(a, b) #define lcm(a, b) ((a) * (b) / gcd(a, b)) #define PI 2 * acos(0.0) // assert(x==y); gives run time when false using namespace std; int main(){ CIN; int n,m; cin >> n >> m; vector<vector<char>> v(n,vector<char>(m)); vii O(n,vi(m,0)),I(n,vi(m,0)); rep(i,0,n){ rep(j,0,m){ cin >> v[i][j]; if(v[i][j]=='O'){ O[i][j]++; } if(v[i][j]=='I'){ I[i][j]++; } } } rep(i,0,n){ per(j,m-2,-1){ O[i][j]+=O[i][j+1]; } } rep(j,0,m){ per(i,n-2,-1){ I[i][j]+=I[i+1][j]; } } ll sum = 0; rep(i,0,n){ rep(j,0,m){ if(v[i][j]=='J'){ sum+=O[i][j]*I[i][j]; } } } cout << sum; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...