답안 #934824

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
934824 2024-02-28T04:48:44 Z tamir1 Count Squares (CEOI19_countsquares) C++17
100 / 100
1548 ms 211556 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(){
	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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 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 123 ms 34136 KB Output is correct
7 Correct 126 ms 33952 KB Output is correct
8 Correct 124 ms 33948 KB Output is correct
9 Correct 120 ms 33104 KB Output is correct
10 Correct 11 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 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 123 ms 34136 KB Output is correct
7 Correct 126 ms 33952 KB Output is correct
8 Correct 124 ms 33948 KB Output is correct
9 Correct 120 ms 33104 KB Output is correct
10 Correct 11 ms 856 KB Output is correct
11 Correct 1531 ms 211556 KB Output is correct
12 Correct 1389 ms 211196 KB Output is correct
13 Correct 1489 ms 211344 KB Output is correct
14 Correct 1548 ms 208820 KB Output is correct
15 Correct 102 ms 1876 KB Output is correct