제출 #319920

#제출 시각아이디문제언어결과실행 시간메모리
319920monus1042Strah (COCI18_strah)C++17
22 / 110
1057 ms23924 KiB
// NK #include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> using namespace std; //using namespace __gnu_pbds; typedef pair<int,int> ii; typedef unsigned long long ll; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<ll> vll; #define pb push_back #define eb emplace_back #define pob pop_back #define psf push_front #define pof pop_front #define mkp make_pair #define mkt make_tuple #define all(x) x.begin(), x.end() #define Bolivia_is_nice ios::sync_with_stdio(false), cin.tie(nullptr) //typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> ord_set; void solve(){ // change ULL int n,m; cin>>n>>m; char ma[n][m]; for (int i=0; i<n; i++){ for (int j=0; j<m; j++){ cin>>ma[i][j]; } } ll ans = 0; int acc[n+1][m+1]; memset(acc, false, sizeof acc); for (int i=0; i<n; i++){ for (int j=0; j<m; j++){ acc[i][j] = acc[i][j-1] + acc[i-1][j] - acc[i-1][j-1]; if (ma[i][j] == '.') acc[i][j]++; } } for (int i=0; i<n; i++){ for (int j=0; j<m; j++){ for (int k=i; k<n; k++){ for (int l=j; l<m; ++l){ int area = (k-i+1) * (l-j+1), ac = acc[k][l] - acc[k][j-1] - acc[i-1][l] + acc[i-1][j-1]; if (area == ac){ ans += (ll)area; } } } } } cout<<ans<<'\n'; } int main(){ Bolivia_is_nice; int t = 1; //cin>>t; while(t--) solve(); return 0; } /* ~/.emacs */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...