Submission #924020

#TimeUsernameProblemLanguageResultExecution timeMemory
924020NurislamBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
275 ms160056 KiB
#include <bits/stdc++.h> #include <iostream> //~ #include <ext/pb_ds/assoc_container.hpp> //~ #include <ext/pb_ds/tree_policy.hpp> using namespace std; //~ using namespace __gnu_pbds; #define pb push_back #define ff first #define ss second #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define int long long //~ #define double long double //~ #define order_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> ///* __ __ __ */ ///* ====== _ /| /| __ _ / | | /| | @ | | | | / /| |\ | / | | @ | / */ ///* \- || |_| |_ / |/ | | | |_ |- | |--| /-| | | \ \ |==| |- /=| | \ | | |--| | |- */ ///* || | | |_ / | |__| _| |_ \__ | | / | |__ | __| | | | \ / | | \| \__ | | | | \ */ ///* typedef vector<int> vi; typedef vector<double> vd; typedef pair<int,int> pii; typedef vector<pii> vii; //~ typedef vector<vi> vv; const int N = 2e5+2, inf = 1e16, mod = 998244353; void solve(){ int h, w; cin >> h >> w; string a[h]; for(auto &i:a)cin >> i; int ci[h+1][w+1]{}; for(int i = 0; i < w; i++){ for(int j = h-1; j >= 0; j--){ ci[j][i] = ci[j+1][i]+(a[j][i] == 'I'); } } int co[h+1][w+1]{}; for(int i = 0; i < h; i++){ for(int j = w-1; j >= 0; j--){ co[i][j] = co[i][j+1] + (a[i][j] == 'O'); } } int ans = 0; for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ if(a[i][j] == 'J')ans+=(co[i][j]*ci[i][j]); } } cout << ans << '\n'; } main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int test = 1; //~ cin >> test; while(test--){ solve(); } }

Compilation message (stderr)

joi2019_ho_t1.cpp:58:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   58 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...