Submission #1239974

#TimeUsernameProblemLanguageResultExecution timeMemory
1239974coderpemulaBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
302 ms220736 KiB
// +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+ \\ /* Some Makoto Shinkai's : “Who cares if we can't see any sunshine? I want you more than any blue sky!!!” - Tenki no Ko "By the time the date is over, the comet will be visible in the sky." - Kimi no Nawa “No matter what happens, even if the stars fall, I will live.” - Byōsoku 5 Centimeter */ #include <bits/stdc++.h> #define Raveluk ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define ld long double #define pb push_back #define fi first #define se second #define pii pair<int,int> #define tii tuple<int,int,int> #define g1 get<0> #define g2 get<1> #define g3 get<2> #define qf q.front() #define all(x) (x).begin(), (x).end() using namespace std; #define int long long signed main() { Raveluk int h,w,i,j,k; cin>>h>>w; char anu[h+1][w+1]; int pref[h+1][w+1][3],ans=0; for(i=0;i<=h;i++){ for(j=0;j<3;j++) pref[i][0][j] = 0; } for(i=0;i<=w;i++){ for(j=0;j<3;j++) pref[0][i][j] = 0; } for(i=1;i<=h;i++){ for(j=1;j<=w;j++){ cin>>anu[i][j]; // row sama = jewel and orb // col sama = jewel and ingot for(k=0;k<3;k++) pref[i][j][k] = pref[i-1][j][k]+pref[i][j-1][k]-pref[i-1][j-1][k]; if(anu[i][j] == 'J') pref[i][j][0]++; if(anu[i][j] == 'O') pref[i][j][1]++; if(anu[i][j] == 'I') pref[i][j][2]++; } } for(i=1;i<=h;i++){ for(j=1;j<=w;j++){ if(anu[i][j] == 'J') ans += (pref[i][w][1]-pref[i-1][w][1]-(pref[i][j][1]-pref[i-1][j][1]))*(pref[h][j][2]-pref[h][j-1][2]-(pref[i][j][2]-pref[i][j-1][2])); } } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...