Submission #207835

#TimeUsernameProblemLanguageResultExecution timeMemory
207835BlerarghBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
247 ms9348 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll,ll> ii; typedef pair<ld,ld> id; #define FOR(i, a, b) for(int i=(a); i<=(b); i++) #define ROF(i, a, b) for(int i=(a); i>=(b); i--) #define MEM(x, v) memset(x, v, sizeof(x)) #define SORT(x) sort((x).begin(), (x).end()) #define CMPSORT(x, cp) sort((x).begin(), (x).end(), cp) #define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define f first #define s second #define e emplace #define eb emplace_back #define ef emplace_front #define ins insert #define p push #define pf push_front #define pb push_back #define mp make_pair #define getchar_unlocked _getchar_nolock #define INF ((long long)1e18) #define MOD 1000000007 #define db cout<<"YEET\n"; #define ct(x) cout<<x<<'\n'; int main(){ FAST ll h, w; char grid[3010][3010]; cin >> h >> w; FOR(i, 1, h){ FOR(j, 1, w){ cin >> grid[i][j]; } } ll power[3010], total=0; MEM(power, 0); FOR(i, 1, h){ FOR(j, 1, w){ if (grid[i][j]=='I') total+=power[j]; } ll ocnt=0; ROF(j, w, 1){ if (grid[i][j]=='O') ocnt++; if (grid[i][j]=='J') power[j]+=ocnt; } } cout << total; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...