# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
168464 |
2019-12-13T08:11:47 Z |
Fischer |
Krave (COI14_krave) |
C++14 |
|
1335 ms |
66676 KB |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
set<int> st[2][maxn<<2];
void add_st(int t, int ll, int rr, int p, int nx=1, int l=0, int r=1e5) {
if (rr < l or r < ll) return;
if (ll <= l and r <= rr) {
st[t][nx].insert(p);
return;
}
int mid = (l+r)/2;
add_st(t, ll, rr, p, nx<<1, l, mid);
add_st(t, ll, rr, p, nx<<1|1, mid+1, r);
}
const int INF = 1e8;
pair<int, int> nil = {0, INF};
pair<int, int> query(int t, int pos, int v, int nx=1, int l=0, int r=1e5) {
if (pos < l or r < pos) return nil;
pair<int, int> L = nil, R = nil, M = nil;
if (l != r) {
int mid = (l + r) / 2;
L = query(t, pos, v, nx<<1, l, mid);
R = query(t, pos, v, nx<<1|1, mid+1, r);
}
if (not st[t][nx].empty()) {
auto q = st[t][nx].lower_bound(v);
if (q == st[t][nx].end()) --q;
if (*q > v) {
M.second = *q;
} else {
M.first = *q;
}
--q;
if (*q < v) {
M.first = max(M.first, *q);
}
}
return {max({L.first, M.first, R.first}),
min({L.second, M.second, R.second})};
}
int main() {
int A, B, N;
cin >> A >> B >> N;
add_st(0, 0, A, 0);
add_st(0, 0, A, B);
add_st(1, 0, B, 0);
add_st(1, 0, B, A);
for (int i = 1; i <= N; ++i) {
int x, y, d;
cin >> x >> y >> d;
pair<int, int> P = query(0, x, y);
pair<int, int> Q = query(1, y, x);
long long a1, a2;
if (d == 1) {
a1 = (y - P.first) *1ll* (Q.second - Q.first);
a2 = (P.second - y) *1ll* (Q.second - Q.first);
add_st(0, Q.first, Q.second, y);
} else {
a1 = (P.second - P.first) *1ll* (x - Q.first);
a2 = (P.second - P.first) *1ll* (Q.second - x);
add_st(1, P.first, P.second, x);
}
if (a1 > a2) swap(a1, a2);
cout << a1 << " " << a2 << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
39 ms |
38008 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
44 ms |
38392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
360 ms |
42852 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
358 ms |
42876 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
356 ms |
42760 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
570 ms |
51704 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1228 ms |
66380 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1222 ms |
65260 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1335 ms |
66464 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1295 ms |
66676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |