답안 #109088

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
109088 2019-05-04T08:19:14 Z ryansee 새 집 (APIO18_new_home) C++14
57 / 100
5000 ms 167396 KB
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN (300006)
#define MAXK 26
#define MAXX 15000006
#define ll /*long long*/ int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
ll n,k,q,ans[MAXN]; vector<ll>d;
struct store {
	int l, type, a, b, i;
} A[MAXN];
vector<store>types[MAXN];
spi Q[MAXN]; // location, time(a,b) with respects to above
struct rays {
	int x=0, in=0, a=0, b=0; // x - point, influence, [a,b] (means inclusive)
	void close(ll y) { assert(b==-1); b = y; }
}; vector<rays>neg,pos;
set <pi> ms;
int currind_pos[MAXN], currind_neg[MAXN];
struct node {
	int s,e,m;
	ll v, lv;
	node *l, *r;
	node(ll _S, ll _E) {
		s = _S, e = _E, m = (s+e)/2;
		v = -INF; lv = -INF;
		if(s!=e) {
			l = new node(s,m);
			r = new node(m+1,e);
		}
	}
	void update(ll x, ll y, ll nv) {
		if(x>y)return;
		if(s==x&&e==y) { v = max(v, nv); return; }
		if(x>m) r->update(x,y,nv);
		else if(y<=m) l->update(x,y,nv);
		else l->update(x,m,nv), r->update(m+1,y,nv);
      	lv = max({l->lv, r->lv,l->v,r->v});
	}
	ll rmq(ll x) {
		if(s==e||v>lv) return v;
		if(x>m) return max(v,r->rmq(x));
		else return max(v,l->rmq(x));
		assert(0);
	}
	void reset() {
	    v = -INF;
	    if(s==e) return;
	    l->reset();
	    r->reset();
	}
} *seg;
ll idx(ll x) { return lbd(d,x)-d.begin(); }
void solve() { 
	FOR(i,0,n) types[A[i].type].pb(A[i]);
	FOR(K,1,k+1) {
		if(types[K].empty()) continue;
// 		sort(all(types[K]), [] (store x, store y) { return x.l < y.l; } ); 
		vector<spi>events; // year to carry out, open/close, index
		for(auto i : types[K]) events.pb(spi(i.a,pi(0,i.i))), events.pb(spi(i.b,pi(1,i.i)));
		sort(all(events)); ms.clear();
		// insert dummy for neg, as well as ms
		ms.ins(pi(-INF,n)); 
		ms.ins(pi(INF,n+1));
		for(auto i : types[K]) currind_pos[i.i]=currind_neg[i.i] = -1; currind_neg[n]=currind_pos[n] = currind_pos[n+1]=currind_neg[n+1] = -1;
		for(auto i : events) {
			ll year = i.f, ind = i.s.s;
			bool op = i.s.f; ll x = A[ind].l;
			if(op == 0) { // open 
				ms.ins(pi(x,ind));
				auto itr = ms.find(pi(x,ind));
				auto itr2 = next(itr);
				--itr;
				// itr -> prev x, itr2 -> next x
				
				/* neg rays */
				// close ray from next to prev, set end time to (year - 1);
				// open ray from curr to prev, set start time to (year);
				// open ray from next to curr, set start time to (year);
				ll ci = currind_neg[itr2->s]; 
				if(ci == -1) { }
				else neg[ci].close(year-1); // close ray from next to prev, set end time to (year - 1);
				
				currind_neg[ind] = (int)neg.size(); // open ray from curr to prev, set start time to (year);
				neg.pb({x,x-(x-itr->f)/2,year,-1});
				// cerr << ind << ' ' << currind[ind] << '\n';
				if(itr2->s < n) {
					currind_neg[itr2->s] = (int)neg.size(); 	// open ray from next to curr, set start time to (year);
					neg.pb({itr2->f, itr2->f-(itr2->f-x)/2,year,-1});
				}
				/* */
				/* pos rays */
				// close ray from prev to next, set end time to (year-1);
				// open ray from prev to curr, set start time to (year);
				// open ray from curr to next, set start time to (year);
				ci = currind_pos[itr->s];
				if(ci == -1) { }
				else pos[ci].close(year-1); // close ray from prev to next, set end time to (year-1);
				
				if(itr->s < n) {
					currind_pos[itr->s] = (int)pos.size();
					pos.pb({itr->f,itr->f+(x-itr->f)/2,year,-1}); // open ray from prev to curr, set start time to (year);
				}
				
				currind_pos[ind] = (int)pos.size();
				pos.pb({x,x+(itr2->f-x)/2,year,-1}); // open ray from curr to next, set start time to (year);
				/* */
			} else {
				auto itr2 = ms.erase(ms.find(pi(x,ind)));
				auto itr = prev(itr2);
				/* neg rays */
				// close ray from curr to prev, end time: year
				// close ray from next to curr, end time: year
				// open ray from next to prev, start time: year+1
				ll ci = currind_neg[ind];
				neg[ci].close(year); // close ray from curr to prev, end time: year
				ci = currind_neg[itr2->s]; if(0)cerr << ci << ' ' << neg.size() << ' ' << itr2->s << '\n';
				if(ci == -1) {} 
				else neg[ci].close(year); // close ray from next to curr, end time: year
				
				if(itr2->s < n) {
					currind_neg[itr2->s] = (int)neg.size();
					neg.pb({itr2->f, itr2->f-(itr2->f-itr->f)/2,year+1,-1}); // open ray from next to prev, start time: year+1
				}
				/* */
				
				/* pos rays */
				// close ray from prev to curr, end time: year
				// close ray from curr to next, end time: year
				// open ray from prev to next, start time: year+1
				ci = currind_pos[itr->s];
				if(ci == -1) { }
				else pos[ci].close(year); // close ray from prev to curr, end time: year
				
				ci = currind_pos[ind];
				assert(ci!=-1);
				pos[ci].close(year); // close ray from curr to next, end time: year
				
				if(itr->s < n) {
					currind_pos[itr->s] = (int)pos.size();
					pos.pb({itr->f,itr->f+(itr2->f-itr->f)/2,year+1,-1}); // open ray from prev to next, start time: year+1
				}
				/* */
			}
		}
		for(auto i : types[K]) currind_neg[i.i]=currind_pos[i.i] = 0; currind_pos[n] = currind_pos[n+1] = 0; currind_neg[n]=currind_neg[n+1]=0;
	}
	for(auto &i : neg) if(i.b == -1) i.b = INF;
	for(auto &i : pos) if(i.b == -1) i.b = INF;
	// for(auto &i : neg) cerr << i.x << ' ' << i.in << ' ' << i.a << ' ' << i.b << '\n';
	// for(auto &i : pos) cerr << i.x << ' ' << i.in << ' ' << i.a << ' ' << i.b << '\n';
	if(0) { FOR(i,0,n) d.pb(A[i].a), d.pb(A[i].b); } for(auto i : neg) d.pb(i.a),d.pb(i.b); for(auto i : pos) d.pb(i.a), d.pb(i.b);
	d.pb(-INF); d.pb(INF);
	sort(all(d)); d.resize(unique(all(d))-d.begin());
	seg=new node(0,siz(d)-1);
	sort(Q,Q+q);
	sort(all(neg), [] (rays x, rays y) { return x.in < y.in; });
	ll co = 0;
	FOR(i,0,q) {
		ll l = Q[i].f, t = Q[i].s.f; ll ind = Q[i].s.s;
		while(co < neg.size() && neg[co].in <= l) {
			seg->update(idx(neg[co].a), idx(neg[co].b), neg[co].x);
			++co;
		}
		ans[ind]=seg->rmq(idx(t))-l;
	}
	if(0) seg=new node(0,siz(d)-1); seg->reset();
	co = 0;
	sort(all(pos), [] (rays x, rays y) { return x.in > y.in; });
// 	reverse(Q,Q+q);
	for(ll i=q-1;i>=0;--i) {
		ll l = Q[i].f, t = Q[i].s.f, ind = Q[i].s.s;
		while(co < pos.size() && pos[co].in >= l) {
			seg->update(idx(pos[co].a), idx(pos[co].b), -pos[co].x);
			++co;
		}
		ans[ind]=max(ans[ind],seg->rmq(idx(t))+l);
	}
	return;
}
/* for when u need negative numbers too */
inline int ri() {
	bool neg = false;
	int res = 0;
	char c = getchar_unlocked();
	while (true) {
		if (c=='-') break;
		if ('0'<=c && c<='9') break;
		c = getchar_unlocked();
	}
	if (c=='-') neg = true;
	else res = c-'0';
	while (true) {
		c = getchar_unlocked();
		if (c<'0' || c>'9') break;
		res = (res<<1) + (res<<3) + (c-'0');
	}
	if (neg) return -res;
	return res;
}
int main()
{
	FAST
	//cin>>n>>k>>q;
  n=ri(),k=ri(),q=ri();
	FOR(i,0,n) { A[i].l=ri(),A[i].type=ri(),A[i].a=ri(),A[i].b=ri();if(0)cin>>A[i].l>>A[i].type>>A[i].a>>A[i].b; A[i].i = i; }
	FOR(i,0,q) {Q[i].f=ri(),Q[i].s.f=ri();if(0)cin>>Q[i].f>>Q[i].s.f;Q[i].s.s=i;}
	
// 	FOR(i,0,n) d.pb(A[i].a), d.pb(A[i].b);
	FOR(i,0,q) d.pb(Q[i].s.f);
// 	sort(all(d)); d.resize(unique(all(d))-d.begin());
	solve(); // get_neg_rays, & pos_rays;
	// check for -1 case here i guess:
	#define storeco currind_pos
	mmst(storeco,0);
	sort(Q,Q+q,[](spi x, spi y){return x.s.f < y.s.f; });
	sort(A,A+n,[](store x, store y){return x.a<y.a;});
	ll co = 0; multiset <pi> ms; multiset <int> deci; FOR(i,1,k+1) deci.ins(0);
	FOR(i,0,q) {
		ll l=Q[i].f,t=Q[i].s.f,ind=Q[i].s.s;
		while(co < n && A[co].a <= t) {
			ms.ins(pi(A[co].b, A[co].type));
			deci.erase(deci.find(storeco[A[co].type]));
			storeco[A[co].type] ++;
			deci.ins(storeco[A[co].type]);
			++co;
		}
		while(ms.size() && ms.begin()->f < t) {
			deci.erase(deci.find(storeco[ms.begin()->s]));
			storeco[ms.begin()->s] --;
			deci.ins(storeco[ms.begin()->s]);
			ms.erase(ms.begin());
		}
		if(*deci.begin() == 0) ans[ind] = -1;
	}
	FOR(i,0,q) cout << ans[i] << '\n';
}
/*
 * 
2 1 1
5 1 1 5
4 1 1 4
5 3
*/

Compilation message

new_home.cpp: In function 'void solve()':
new_home.cpp:91:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   for(auto i : types[K]) currind_pos[i.i]=currind_neg[i.i] = -1; currind_neg[n]=currind_pos[n] = currind_pos[n+1]=currind_neg[n+1] = -1;
   ^~~
new_home.cpp:91:66: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   for(auto i : types[K]) currind_pos[i.i]=currind_neg[i.i] = -1; currind_neg[n]=currind_pos[n] = currind_pos[n+1]=currind_neg[n+1] = -1;
                                                                  ^~~~~~~~~~~
new_home.cpp:172:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   for(auto i : types[K]) currind_neg[i.i]=currind_pos[i.i] = 0; currind_pos[n] = currind_pos[n+1] = 0; currind_neg[n]=currind_neg[n+1]=0;
   ^~~
new_home.cpp:172:65: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   for(auto i : types[K]) currind_neg[i.i]=currind_pos[i.i] = 0; currind_pos[n] = currind_pos[n+1] = 0; currind_neg[n]=currind_neg[n+1]=0;
                                                                 ^~~~~~~~~~~
new_home.cpp:187:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(co < neg.size() && neg[co].in <= l) {
         ~~~^~~~~~~~~~~~
new_home.cpp:193:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
  if(0) seg=new node(0,siz(d)-1); seg->reset();
  ^~
new_home.cpp:193:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  if(0) seg=new node(0,siz(d)-1); seg->reset();
                                  ^~~
new_home.cpp:199:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(co < pos.size() && pos[co].in >= l) {
         ~~~^~~~~~~~~~~~
new_home.cpp: In function 'int main()':
new_home.cpp:246:6: warning: unused variable 'l' [-Wunused-variable]
   ll l=Q[i].f,t=Q[i].s.f,ind=Q[i].s.s;
      ^
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 8576 KB Output is correct
2 Correct 17 ms 8576 KB Output is correct
3 Correct 11 ms 8576 KB Output is correct
4 Correct 10 ms 8576 KB Output is correct
5 Correct 11 ms 8704 KB Output is correct
6 Correct 13 ms 8832 KB Output is correct
7 Correct 11 ms 8704 KB Output is correct
8 Correct 12 ms 8832 KB Output is correct
9 Correct 13 ms 8832 KB Output is correct
10 Correct 11 ms 8832 KB Output is correct
11 Correct 11 ms 8832 KB Output is correct
12 Correct 12 ms 8832 KB Output is correct
13 Correct 11 ms 8704 KB Output is correct
14 Correct 58 ms 8824 KB Output is correct
15 Correct 13 ms 8832 KB Output is correct
16 Correct 11 ms 8960 KB Output is correct
17 Correct 12 ms 8832 KB Output is correct
18 Correct 12 ms 8896 KB Output is correct
19 Correct 13 ms 8832 KB Output is correct
20 Correct 11 ms 8832 KB Output is correct
21 Correct 12 ms 8704 KB Output is correct
22 Correct 12 ms 8832 KB Output is correct
23 Correct 11 ms 8832 KB Output is correct
24 Correct 11 ms 8832 KB Output is correct
25 Correct 11 ms 8832 KB Output is correct
26 Correct 11 ms 8832 KB Output is correct
27 Correct 12 ms 8780 KB Output is correct
28 Correct 10 ms 8832 KB Output is correct
29 Correct 11 ms 8832 KB Output is correct
30 Correct 11 ms 8704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 8576 KB Output is correct
2 Correct 17 ms 8576 KB Output is correct
3 Correct 11 ms 8576 KB Output is correct
4 Correct 10 ms 8576 KB Output is correct
5 Correct 11 ms 8704 KB Output is correct
6 Correct 13 ms 8832 KB Output is correct
7 Correct 11 ms 8704 KB Output is correct
8 Correct 12 ms 8832 KB Output is correct
9 Correct 13 ms 8832 KB Output is correct
10 Correct 11 ms 8832 KB Output is correct
11 Correct 11 ms 8832 KB Output is correct
12 Correct 12 ms 8832 KB Output is correct
13 Correct 11 ms 8704 KB Output is correct
14 Correct 58 ms 8824 KB Output is correct
15 Correct 13 ms 8832 KB Output is correct
16 Correct 11 ms 8960 KB Output is correct
17 Correct 12 ms 8832 KB Output is correct
18 Correct 12 ms 8896 KB Output is correct
19 Correct 13 ms 8832 KB Output is correct
20 Correct 11 ms 8832 KB Output is correct
21 Correct 12 ms 8704 KB Output is correct
22 Correct 12 ms 8832 KB Output is correct
23 Correct 11 ms 8832 KB Output is correct
24 Correct 11 ms 8832 KB Output is correct
25 Correct 11 ms 8832 KB Output is correct
26 Correct 11 ms 8832 KB Output is correct
27 Correct 12 ms 8780 KB Output is correct
28 Correct 10 ms 8832 KB Output is correct
29 Correct 11 ms 8832 KB Output is correct
30 Correct 11 ms 8704 KB Output is correct
31 Correct 1038 ms 54420 KB Output is correct
32 Correct 209 ms 25408 KB Output is correct
33 Correct 955 ms 51940 KB Output is correct
34 Correct 1086 ms 52292 KB Output is correct
35 Correct 1092 ms 53644 KB Output is correct
36 Correct 830 ms 53768 KB Output is correct
37 Correct 639 ms 50980 KB Output is correct
38 Correct 661 ms 50820 KB Output is correct
39 Correct 473 ms 50600 KB Output is correct
40 Correct 480 ms 50600 KB Output is correct
41 Correct 869 ms 48460 KB Output is correct
42 Correct 875 ms 48796 KB Output is correct
43 Correct 106 ms 23484 KB Output is correct
44 Correct 739 ms 48900 KB Output is correct
45 Correct 850 ms 48684 KB Output is correct
46 Correct 784 ms 48440 KB Output is correct
47 Correct 296 ms 44508 KB Output is correct
48 Correct 311 ms 45264 KB Output is correct
49 Correct 420 ms 47108 KB Output is correct
50 Correct 446 ms 47236 KB Output is correct
51 Correct 363 ms 47160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1645 ms 108020 KB Output is correct
2 Correct 1537 ms 113736 KB Output is correct
3 Correct 1358 ms 104080 KB Output is correct
4 Correct 1528 ms 105952 KB Output is correct
5 Correct 2144 ms 113204 KB Output is correct
6 Correct 1693 ms 113760 KB Output is correct
7 Correct 1083 ms 104256 KB Output is correct
8 Correct 1147 ms 104448 KB Output is correct
9 Correct 1282 ms 110248 KB Output is correct
10 Correct 1284 ms 115244 KB Output is correct
11 Correct 1155 ms 112220 KB Output is correct
12 Correct 1202 ms 114044 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5049 ms 167396 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 8576 KB Output is correct
2 Correct 17 ms 8576 KB Output is correct
3 Correct 11 ms 8576 KB Output is correct
4 Correct 10 ms 8576 KB Output is correct
5 Correct 11 ms 8704 KB Output is correct
6 Correct 13 ms 8832 KB Output is correct
7 Correct 11 ms 8704 KB Output is correct
8 Correct 12 ms 8832 KB Output is correct
9 Correct 13 ms 8832 KB Output is correct
10 Correct 11 ms 8832 KB Output is correct
11 Correct 11 ms 8832 KB Output is correct
12 Correct 12 ms 8832 KB Output is correct
13 Correct 11 ms 8704 KB Output is correct
14 Correct 58 ms 8824 KB Output is correct
15 Correct 13 ms 8832 KB Output is correct
16 Correct 11 ms 8960 KB Output is correct
17 Correct 12 ms 8832 KB Output is correct
18 Correct 12 ms 8896 KB Output is correct
19 Correct 13 ms 8832 KB Output is correct
20 Correct 11 ms 8832 KB Output is correct
21 Correct 12 ms 8704 KB Output is correct
22 Correct 12 ms 8832 KB Output is correct
23 Correct 11 ms 8832 KB Output is correct
24 Correct 11 ms 8832 KB Output is correct
25 Correct 11 ms 8832 KB Output is correct
26 Correct 11 ms 8832 KB Output is correct
27 Correct 12 ms 8780 KB Output is correct
28 Correct 10 ms 8832 KB Output is correct
29 Correct 11 ms 8832 KB Output is correct
30 Correct 11 ms 8704 KB Output is correct
31 Correct 1038 ms 54420 KB Output is correct
32 Correct 209 ms 25408 KB Output is correct
33 Correct 955 ms 51940 KB Output is correct
34 Correct 1086 ms 52292 KB Output is correct
35 Correct 1092 ms 53644 KB Output is correct
36 Correct 830 ms 53768 KB Output is correct
37 Correct 639 ms 50980 KB Output is correct
38 Correct 661 ms 50820 KB Output is correct
39 Correct 473 ms 50600 KB Output is correct
40 Correct 480 ms 50600 KB Output is correct
41 Correct 869 ms 48460 KB Output is correct
42 Correct 875 ms 48796 KB Output is correct
43 Correct 106 ms 23484 KB Output is correct
44 Correct 739 ms 48900 KB Output is correct
45 Correct 850 ms 48684 KB Output is correct
46 Correct 784 ms 48440 KB Output is correct
47 Correct 296 ms 44508 KB Output is correct
48 Correct 311 ms 45264 KB Output is correct
49 Correct 420 ms 47108 KB Output is correct
50 Correct 446 ms 47236 KB Output is correct
51 Correct 363 ms 47160 KB Output is correct
52 Correct 515 ms 38916 KB Output is correct
53 Correct 452 ms 37084 KB Output is correct
54 Correct 913 ms 46720 KB Output is correct
55 Correct 741 ms 44880 KB Output is correct
56 Correct 631 ms 43432 KB Output is correct
57 Correct 844 ms 46644 KB Output is correct
58 Correct 851 ms 44892 KB Output is correct
59 Correct 715 ms 43604 KB Output is correct
60 Correct 780 ms 47080 KB Output is correct
61 Correct 109 ms 22360 KB Output is correct
62 Correct 541 ms 39080 KB Output is correct
63 Correct 667 ms 44092 KB Output is correct
64 Correct 765 ms 45468 KB Output is correct
65 Correct 1039 ms 47164 KB Output is correct
66 Correct 763 ms 47908 KB Output is correct
67 Correct 165 ms 21208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 8576 KB Output is correct
2 Correct 17 ms 8576 KB Output is correct
3 Correct 11 ms 8576 KB Output is correct
4 Correct 10 ms 8576 KB Output is correct
5 Correct 11 ms 8704 KB Output is correct
6 Correct 13 ms 8832 KB Output is correct
7 Correct 11 ms 8704 KB Output is correct
8 Correct 12 ms 8832 KB Output is correct
9 Correct 13 ms 8832 KB Output is correct
10 Correct 11 ms 8832 KB Output is correct
11 Correct 11 ms 8832 KB Output is correct
12 Correct 12 ms 8832 KB Output is correct
13 Correct 11 ms 8704 KB Output is correct
14 Correct 58 ms 8824 KB Output is correct
15 Correct 13 ms 8832 KB Output is correct
16 Correct 11 ms 8960 KB Output is correct
17 Correct 12 ms 8832 KB Output is correct
18 Correct 12 ms 8896 KB Output is correct
19 Correct 13 ms 8832 KB Output is correct
20 Correct 11 ms 8832 KB Output is correct
21 Correct 12 ms 8704 KB Output is correct
22 Correct 12 ms 8832 KB Output is correct
23 Correct 11 ms 8832 KB Output is correct
24 Correct 11 ms 8832 KB Output is correct
25 Correct 11 ms 8832 KB Output is correct
26 Correct 11 ms 8832 KB Output is correct
27 Correct 12 ms 8780 KB Output is correct
28 Correct 10 ms 8832 KB Output is correct
29 Correct 11 ms 8832 KB Output is correct
30 Correct 11 ms 8704 KB Output is correct
31 Correct 1038 ms 54420 KB Output is correct
32 Correct 209 ms 25408 KB Output is correct
33 Correct 955 ms 51940 KB Output is correct
34 Correct 1086 ms 52292 KB Output is correct
35 Correct 1092 ms 53644 KB Output is correct
36 Correct 830 ms 53768 KB Output is correct
37 Correct 639 ms 50980 KB Output is correct
38 Correct 661 ms 50820 KB Output is correct
39 Correct 473 ms 50600 KB Output is correct
40 Correct 480 ms 50600 KB Output is correct
41 Correct 869 ms 48460 KB Output is correct
42 Correct 875 ms 48796 KB Output is correct
43 Correct 106 ms 23484 KB Output is correct
44 Correct 739 ms 48900 KB Output is correct
45 Correct 850 ms 48684 KB Output is correct
46 Correct 784 ms 48440 KB Output is correct
47 Correct 296 ms 44508 KB Output is correct
48 Correct 311 ms 45264 KB Output is correct
49 Correct 420 ms 47108 KB Output is correct
50 Correct 446 ms 47236 KB Output is correct
51 Correct 363 ms 47160 KB Output is correct
52 Correct 1645 ms 108020 KB Output is correct
53 Correct 1537 ms 113736 KB Output is correct
54 Correct 1358 ms 104080 KB Output is correct
55 Correct 1528 ms 105952 KB Output is correct
56 Correct 2144 ms 113204 KB Output is correct
57 Correct 1693 ms 113760 KB Output is correct
58 Correct 1083 ms 104256 KB Output is correct
59 Correct 1147 ms 104448 KB Output is correct
60 Correct 1282 ms 110248 KB Output is correct
61 Correct 1284 ms 115244 KB Output is correct
62 Correct 1155 ms 112220 KB Output is correct
63 Correct 1202 ms 114044 KB Output is correct
64 Execution timed out 5049 ms 167396 KB Time limit exceeded
65 Halted 0 ms 0 KB -