# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
934823 | tamir1 | Count Squares (CEOI19_countsquares) | C++14 | 1466 ms | 211476 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll i,j,h,v,x[2000],y[2000],ans;
map<ll,ll> mp1,mp2;
int main(){
cin >> h >> v;
for(i=1;i<=h;i++){
cin >> y[i];
}
for(i=1;i<=v;i++){
cin >> x[i];
}
for(i=1;i<=h;i++){
for(j=i+1;j<=h;j++)
mp1[y[j]-y[i]]++;
}
for(i=1;i<=v;i++){
for(j=i+1;j<=v;j++)
mp2[x[j]-x[i]]++;
}
for(auto [a,b]:mp1){
ans+=(b*mp2[a]);
}
cout << ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |