Submission #22930

# Submission time Handle Problem Language Result Execution time Memory
22930 2017-04-30T13:24:39 Z dotorya Donut-shaped Enclosure (KRIII5_DE) C++14
7 / 7
1389 ms 37564 KB
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 1034567890123456789ll;
const db PI = acos(-1);
const db ERR = 1E-11;

class Node {
public:
	int mx, v;
	Node() { mx = 0, v = 0; }
};
Node indt[1100000];
void update(int st, int en, int S, int E, int n, int v) {
	if (st > en) return;
	if (st == S && en == E) {
		indt[n].mx += v;
		indt[n].v += v;
		return;
	}

	int M = (S + E) / 2;
	update(st, min(en, M), S, M, 2 * n, v);
	update(max(M + 1, st), en, M + 1, E, 2 * n + 1, v);
	indt[n].mx = indt[n].v + max(indt[2 * n].mx, indt[2 * n + 1].mx);
}

vector <pair<pii, pii>> Vq;
vector <int> Vy;
map <int, int> My;
int main() {
	int N, L, R, i;
	scanf("%d %d %d", &N, &L, &R);
	while (N--) {
		int t1, t2, t3;
		scanf("%d %d %d", &t1, &t2, &t3);

		Vq.emplace_back(pii(t1 - R, t3), pii(t2 - R, t2 + R + 1));
		Vq.emplace_back(pii(t1 + R + 1, -t3), pii(t2 - R, t2 + R + 1));
		Vq.emplace_back(pii(t1 - L + 1, -t3), pii(t2 - L + 1, t2 + L));
		Vq.emplace_back(pii(t1 + L, t3), pii(t2 - L + 1, t2 + L));

		My[t2 - R] = 0;
		My[t2 + R + 1] = 0;
		My[t2 - L + 1] = 0;
		My[t2 + L] = 0;
	}
	i = 0;
	for (auto &it : My) it.second = ++i;
	for (auto &it : Vq) {
		it.second.first = My[it.second.first];
		it.second.second = My[it.second.second] - 1;
	}
	sort(all(Vq));

	int ans = 0;
	for (i = 0; i < Vq.size(); i++) {
		int t1 = Vq[i].first.first, t2 = Vq[i].first.second, t3 = Vq[i].second.first, t4 = Vq[i].second.second;
		update(t3, t4, 1, IT_MAX, 1, t2);
		if (i + 1 == Vq.size() || Vq[i].first.first != Vq[i + 1].first.first) ans = max(ans, indt[1].mx);
	}
	return !printf("%d\n", ans);
}

Compilation message

DE.cpp:22:0: warning: ignoring #pragma warning  [-Wunknown-pragmas]
 #pragma warning(disable:4996)
 ^
DE.cpp:23:0: warning: ignoring #pragma comment  [-Wunknown-pragmas]
 #pragma comment(linker, "/STACK:336777216")
 ^
DE.cpp: In function 'int main()':
DE.cpp:101:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (i = 0; i < Vq.size(); i++) {
                ^
DE.cpp:104:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (i + 1 == Vq.size() || Vq[i].first.first != Vq[i + 1].first.first) ans = max(ans, indt[1].mx);
             ^
DE.cpp:102:7: warning: unused variable 't1' [-Wunused-variable]
   int t1 = Vq[i].first.first, t2 = Vq[i].first.second, t3 = Vq[i].second.first, t4 = Vq[i].second.second;
       ^
DE.cpp:77:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d", &N, &L, &R);
                               ^
DE.cpp:80:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d", &t1, &t2, &t3);
                                   ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 10620 KB Output is correct
2 Correct 3 ms 10620 KB Output is correct
3 Correct 3 ms 10620 KB Output is correct
4 Correct 0 ms 10620 KB Output is correct
5 Correct 3 ms 10620 KB Output is correct
6 Correct 3 ms 10620 KB Output is correct
7 Correct 3 ms 10752 KB Output is correct
8 Correct 3 ms 10752 KB Output is correct
9 Correct 6 ms 10752 KB Output is correct
10 Correct 6 ms 10780 KB Output is correct
11 Correct 6 ms 10752 KB Output is correct
12 Correct 6 ms 10752 KB Output is correct
13 Correct 3 ms 10780 KB Output is correct
14 Correct 9 ms 10752 KB Output is correct
15 Correct 9 ms 10780 KB Output is correct
16 Correct 6 ms 10752 KB Output is correct
17 Correct 6 ms 10780 KB Output is correct
18 Correct 6 ms 10752 KB Output is correct
19 Correct 3 ms 10780 KB Output is correct
20 Correct 6 ms 10776 KB Output is correct
21 Correct 3 ms 10780 KB Output is correct
22 Correct 3 ms 10780 KB Output is correct
23 Correct 3 ms 10752 KB Output is correct
24 Correct 3 ms 10752 KB Output is correct
25 Correct 3 ms 10752 KB Output is correct
26 Correct 6 ms 10752 KB Output is correct
27 Correct 3 ms 10752 KB Output is correct
28 Correct 6 ms 10752 KB Output is correct
29 Correct 3 ms 10780 KB Output is correct
30 Correct 0 ms 10752 KB Output is correct
31 Correct 3 ms 10764 KB Output is correct
32 Correct 0 ms 10764 KB Output is correct
33 Correct 3 ms 10764 KB Output is correct
34 Correct 3 ms 10768 KB Output is correct
35 Correct 3 ms 10768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 10620 KB Output is correct
2 Correct 3 ms 10620 KB Output is correct
3 Correct 3 ms 10620 KB Output is correct
4 Correct 0 ms 10620 KB Output is correct
5 Correct 3 ms 10620 KB Output is correct
6 Correct 3 ms 10620 KB Output is correct
7 Correct 3 ms 10752 KB Output is correct
8 Correct 3 ms 10752 KB Output is correct
9 Correct 6 ms 10752 KB Output is correct
10 Correct 6 ms 10780 KB Output is correct
11 Correct 6 ms 10752 KB Output is correct
12 Correct 6 ms 10752 KB Output is correct
13 Correct 3 ms 10780 KB Output is correct
14 Correct 9 ms 10752 KB Output is correct
15 Correct 9 ms 10780 KB Output is correct
16 Correct 6 ms 10752 KB Output is correct
17 Correct 6 ms 10780 KB Output is correct
18 Correct 6 ms 10752 KB Output is correct
19 Correct 3 ms 10780 KB Output is correct
20 Correct 6 ms 10776 KB Output is correct
21 Correct 3 ms 10780 KB Output is correct
22 Correct 3 ms 10780 KB Output is correct
23 Correct 3 ms 10752 KB Output is correct
24 Correct 3 ms 10752 KB Output is correct
25 Correct 3 ms 10752 KB Output is correct
26 Correct 6 ms 10752 KB Output is correct
27 Correct 3 ms 10752 KB Output is correct
28 Correct 6 ms 10752 KB Output is correct
29 Correct 3 ms 10780 KB Output is correct
30 Correct 0 ms 10752 KB Output is correct
31 Correct 3 ms 10764 KB Output is correct
32 Correct 0 ms 10764 KB Output is correct
33 Correct 3 ms 10764 KB Output is correct
34 Correct 3 ms 10768 KB Output is correct
35 Correct 3 ms 10768 KB Output is correct
36 Correct 0 ms 10620 KB Output is correct
37 Correct 6 ms 10752 KB Output is correct
38 Correct 9 ms 11020 KB Output is correct
39 Correct 13 ms 11152 KB Output is correct
40 Correct 19 ms 11544 KB Output is correct
41 Correct 19 ms 12192 KB Output is correct
42 Correct 39 ms 12328 KB Output is correct
43 Correct 56 ms 12592 KB Output is correct
44 Correct 73 ms 13752 KB Output is correct
45 Correct 86 ms 14028 KB Output is correct
46 Correct 106 ms 14556 KB Output is correct
47 Correct 136 ms 16740 KB Output is correct
48 Correct 173 ms 16740 KB Output is correct
49 Correct 556 ms 24888 KB Output is correct
50 Correct 609 ms 25152 KB Output is correct
51 Correct 1313 ms 37564 KB Output is correct
52 Correct 1219 ms 37564 KB Output is correct
53 Correct 1256 ms 37564 KB Output is correct
54 Correct 1389 ms 37564 KB Output is correct
55 Correct 1159 ms 37564 KB Output is correct
56 Correct 1309 ms 37564 KB Output is correct
57 Correct 1276 ms 37564 KB Output is correct
58 Correct 1329 ms 37564 KB Output is correct
59 Correct 1073 ms 37564 KB Output is correct
60 Correct 1299 ms 37564 KB Output is correct
61 Correct 9 ms 11152 KB Output is correct
62 Correct 83 ms 14028 KB Output is correct
63 Correct 216 ms 17428 KB Output is correct
64 Correct 589 ms 24096 KB Output is correct
65 Correct 1369 ms 37564 KB Output is correct
66 Correct 616 ms 29004 KB Output is correct
67 Correct 619 ms 29136 KB Output is correct
68 Correct 579 ms 29008 KB Output is correct
69 Correct 569 ms 29012 KB Output is correct
70 Correct 646 ms 29144 KB Output is correct
71 Correct 636 ms 29004 KB Output is correct
72 Correct 656 ms 29140 KB Output is correct
73 Correct 736 ms 29008 KB Output is correct
74 Correct 719 ms 29136 KB Output is correct
75 Correct 759 ms 29140 KB Output is correct
76 Correct 749 ms 29012 KB Output is correct
77 Correct 803 ms 29012 KB Output is correct
78 Correct 813 ms 29148 KB Output is correct
79 Correct 869 ms 29120 KB Output is correct
80 Correct 826 ms 29120 KB Output is correct