이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <string>
#include <limits>
#include <assert.h>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long int;
const ll mod = 998244353;
int main(){
cin.tie(0);
ios_base::sync_with_stdio(false);
int h, w;
cin >> h >> w;
vector<ll> hor(h), ver(w);
for(auto& i : hor){
cin >> i;
}
for(auto& i : ver){
cin >> i;
}
map<ll, ll> m;
for(int i = 0; i < h; ++i){
for(int j = i + 1; j < h; ++j){
++m[hor[j] - hor[i]];
}
}
ll answ = 0;
for(int i = 0; i < w; ++i){
for(int j = i + 1; j < w; ++j){
answ += m[ver[j] - ver[i]];
}
}
cout << answ << endl;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |