이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define int long long
#define tin long long 
#define db double
#define F first
#define S second
#define yes "YES"
#define no "NO"
using namespace std;
int a[100000], N = 2e6 + 5, b[100000];
int mn = INT_MAX, mx = INT_MAX;
void solve(){
	int n, m, ans = 0;
	cin >> n >> m;
	map <int, int> cnt;
	for(int i = 1; i <= n ; i++){
		cin >> a[i];
	} 
	for(int i = 1 ; i <= m ; i++){
		cin >> b[i];
	}
	for(int i = 1; i <= n ; i ++){
		for(int j = i + 1 ; j <= n ; j ++){ 
			cnt[a[j] - a[i]]++;
		}
	}
	for(int i = 1; i <= m ; i ++){
		for(int j = i + 1 ; j <= m ; j ++){
			ans += cnt[b[j] - b[i]];
		}
	}
	cout << ans;
}
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |