Submission #934825

# Submission time Handle Problem Language Result Execution time Memory
934825 2024-02-28T04:49:43 Z tamir1 Count Squares (CEOI19_countsquares) C++17
100 / 100
1527 ms 211356 KB
#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(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	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;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 120 ms 34044 KB Output is correct
7 Correct 133 ms 34028 KB Output is correct
8 Correct 125 ms 34136 KB Output is correct
9 Correct 118 ms 33076 KB Output is correct
10 Correct 9 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 120 ms 34044 KB Output is correct
7 Correct 133 ms 34028 KB Output is correct
8 Correct 125 ms 34136 KB Output is correct
9 Correct 118 ms 33076 KB Output is correct
10 Correct 9 ms 860 KB Output is correct
11 Correct 1527 ms 211356 KB Output is correct
12 Correct 1453 ms 211248 KB Output is correct
13 Correct 1491 ms 211272 KB Output is correct
14 Correct 1390 ms 209488 KB Output is correct
15 Correct 90 ms 1920 KB Output is correct