Submission #262600

# Submission time Handle Problem Language Result Execution time Memory
262600 2020-08-13T05:05:14 Z 임성재(#5086) Pairs (IOI07_pairs) C++17
12 / 100
2 ms 640 KB
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define pre(a) cout << fixed; cout.precision(a);
#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define all(v) (v).begin() (v).end()
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;

struct point {
	ll x[3];
	point() {
		x[0] = x[1] = x[2] = 0;
	}

	bool operator<(point &p) {
		return mt(x[0], x[1], x[2]) < mt(p.x[0], p.x[1], p.x[2]);
	}
};

ll b, n, d, m;
point p[1010];

ll dist(int i, int j) {
	ll ret = 0;
	for(int k=0; k<3; k++) {
		ret += abs(p[i].x[k] - p[j].x[k]);
	}

	return ret;
}

int main() {
	fast;

	cin >> b >> n >> d >> m;

	for(int i=1; i<=n; i++) {
		for(int j=0; j<b; j++) {
			cin >> p[i].x[j];
		}
	}

	sort(p+1, p+n+1);

	ll ans = 0;
	int idx = 1;
	for(int i=1; i<=n; i++) {
		while(idx <= n && dist(idx, i) <= d) idx++;

		ans += idx - i - 1;
	}

	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 612 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 1 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -