답안 #605758

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
605758 2022-07-26T01:39:20 Z ukraine Count Squares (CEOI19_countsquares) C++17
100 / 100
1932 ms 211200 KB
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define ins insert
#define setpre(i) setprecision(i) << fixed
#define foru(i,a,b) for(int i = a; i <= b; i++)
#define ford(i,a,b) for(int i = a; i >= b; i--)
using namespace std;

typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef vector<vector<pll> > vvl;
typedef vector<int> vi;
const ll inf = INT_MIN;
const ll mod = 1e9+7;

map<ll, int> cntx;
map<ll, int> cnty;

ll x[1501], y[1501];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    int n,m; cin >> n >> m;
    foru(i,1,n) {
    	cin >> y[i];
    	foru(j,1,i-1) {
    		cnty[y[i]-y[j]]++;
		}
	}
	foru(i,1,m) {
		cin >> x[i];
		foru(j,1,i-1) {
    		cntx[x[i]-x[j]]++;
		}
	}
	ll ans = 0;
	for(auto v : cnty) {
		//cout << v.fi << " " << v.se << " " << cntx[v.fi] << "\n";
		ans += (v.se*cntx[v.fi]);
	}
	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 171 ms 34076 KB Output is correct
7 Correct 162 ms 33924 KB Output is correct
8 Correct 170 ms 33928 KB Output is correct
9 Correct 161 ms 33044 KB Output is correct
10 Correct 9 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 171 ms 34076 KB Output is correct
7 Correct 162 ms 33924 KB Output is correct
8 Correct 170 ms 33928 KB Output is correct
9 Correct 161 ms 33044 KB Output is correct
10 Correct 9 ms 852 KB Output is correct
11 Correct 1788 ms 211200 KB Output is correct
12 Correct 1932 ms 211128 KB Output is correct
13 Correct 1909 ms 211168 KB Output is correct
14 Correct 1929 ms 208828 KB Output is correct
15 Correct 73 ms 1848 KB Output is correct