이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
#define clr(a, x) memset(a, x, sizeof(a))
#define dbg(x) cout<<"("<<#x<<"): "<<x<<endl;
#define printvector(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout<<*it<<" "; cout<<endl;
#define all(v) v.begin(), v.end()
#define lcm(a, b) (a * b)/__gcd(a, b)
#define printvecpairs(vec) for(auto it: vec) cout<<it.fr<<' '<<it.sc<<endl;
#define endl '\n'
#define lli long long int
#define float long double
const int MOD = 1e9 + 7;
const int MAXN = 2506;
int pref[MAXN][MAXN];
lli sum(vector<vector<int>> ahnice){
return 0LL;
}
lli count_rectangles(vector<vector<int>> a) {
int n = a.size();
int m = a[0].size();
lli ans =0;
pref[0][0] = a[0][0];
for(int i=1;i<n;i++) pref[0][i] = pref[0][i-1] + a[0][i];
for(int i=1;i<m;i++) pref[i][0] = pref[i-1][0] + a[i][0];
for(int i= 1;i<n;i++){
for(int j= 1;j<m;j++){
pref[i][j] = pref[i-1][j] + pref[i][j-1] - pref[i-1][j-1] + a[i][j];
}
}
// sum(pref);
// for(int r1= 0;r1<n;r1++){
// for(int c1= 0;c1<m;c1++){
// for(int r2= r1+2;r2<n;r2++){
// for(int c2= c1+2;c2<m;c2++){
// // sum
// }
// }
// }
// }
return ans;
}
// signed main() {
// ios_base::sync_with_stdio(false);
// cin.tie(NULL);
// #ifdef LOCAL
// freopen("input.txt", "r", stdin);
// #endif
// int n, m;
// cin>>n>>m;
// vector<vector<int>> vec;
// for(int i= 0;i<n;i++){
// vector<int> tmp;
// for(int j= 0;j<m;j++){
// int x;
// cin>>x;
// tmp.pb(x);
// }
// vec.pb(tmp);
// }
// cout<<count_rectangles(vec)<<endl;
// return 0;
// }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |