답안 #851877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
851877 2023-09-20T18:00:46 Z MilosMilutinovic Fish 2 (JOI22_fish2) C++14
100 / 100
1948 ms 76736 KB
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> B;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=100100;
const int M=8*N;
const int inf=(int)1e9;
int n,q,a[N];

namespace sum {
	ll c[N];
	void modify(int p,int v) {
		for (;p<N;p+=p&-p) c[p]+=v;
	}
	ll get(int p) {
		ll r=0;
		for (;p>0;p-=p&-p) r+=c[p];
		return r;
	}
	ll get(int l,int r) {
		if (l>r) {
			return 0ll;
		}
		return get(r)-get(l-1);
	}
};

namespace cnt {
	PII st[M];
	int lzy[M];
	void push(int x) {
		st[x*2].fi+=lzy[x];
		st[x*2+1].fi+=lzy[x];
		lzy[x*2]+=lzy[x];
		lzy[x*2+1]+=lzy[x];
		lzy[x]=0;
	}
	PII mrg(PII a,PII b) {
		PII r;
		r.fi=min(a.fi,b.fi);
		r.se=(a.fi==r.fi?a.se:0)+(b.fi==r.fi?b.se:0);
		return r;
	}
	void pull(int x) {
		st[x]=mrg(st[x*2],st[x*2+1]);
	}
	void build(int x,int l,int r) {
		if (l==r) {
			st[x].fi=0;
			st[x].se=1;
			return;
		}
		int mid=l+r>>1;
		build(x*2,l,mid);
		build(x*2+1,mid+1,r);
		pull(x);
	}
	void add(int x,int l,int r,int ql,int qr,int v) {
		if (l>r||l>qr||r<ql||ql>qr) {
			return;
		}
		if (ql<=l&&r<=qr) {
			st[x].fi+=v;
			lzy[x]+=v;
			push(x);
			return;
		}
		push(x);
		int mid=l+r>>1;
		add(x*2,l,mid,ql,qr,v);
		add(x*2+1,mid+1,r,ql,qr,v);
		pull(x);
	}
	PII query(int x,int l,int r,int ql,int qr) {
		if (l>r||l>qr||r<ql) {
			return mp(inf,0);
		}
		if (ql<=l&&r<=qr) {
			return st[x];
		}
		push(x);
		int mid=l+r>>1;
		auto qvl=query(x*2,l,mid,ql,qr);
		auto qvr=query(x*2+1,mid+1,r,ql,qr);
		pull(x);
		return mrg(qvl,qvr);
	}
	int sol(int l,int r) {
		auto p=query(1,1,n,l,r);
		return p.se;
	}
};

vector<PII> my;
namespace segs {
	vector<PII> st[M];
	multiset<PII> all;
	void add(int x,int l,int r,int ql,int qr,PII p) {
		if (x==1) all.insert(p);
		if (l>r||l>qr||r<ql) {
			return;
		}
		if (ql<=l&&r<=qr) {
			st[x].pb(p);
			return;
		}
		int mid=l+r>>1;
		add(x*2,l,mid,ql,qr,p);
		add(x*2+1,mid+1,r,ql,qr,p);
	}
	/* void rem(int x,int l,int r,PII p) {
		if (l>r||l>p.se||r<p.fi) {
			return;
		}
		if (p.fi<=l&&r<=p.se) {
			st[x].erase(st[x].find(p));
			return;
		}
		int mid=l+r>>1;
		rem(x*2,l,mid,p);
		rem(x*2+1,mid+1,r,p);
	} */
	void dfs(int x,int l,int r,int p) {
		for (auto& p:st[x]) {
			if (all.find(p)!=all.end()) {
				all.erase(all.find(p));
				cnt::add(1,1,n,p.fi+1,p.se-1,-1);
			}
		}
		st[x].clear();
		if (l==r) {
			return;
		}
		int mid=l+r>>1;
		if (p<=mid) {
			dfs(x*2,l,mid,p);
		} else {
			dfs(x*2+1,mid+1,r,p);
		}
	}
};

namespace pref {
	struct node {
		ll vl,vr,lzyl,lzyr;
		node(ll _vl=0,ll _vr=0,ll tg1=0,ll tg2=0) : vl(_vl),vr(_vr),lzyl(tg1),lzyr(tg2) {}
	};
	node st[M];
	node mrg(node a,node b) {
		node r;
		r.vl=max(a.vl,b.vl);
		r.vr=max(a.vr,b.vr);
		return r;
	}
	void pull(int x) {
		st[x]=mrg(st[x*2],st[x*2+1]);
	}
	void push(int x) {
		st[x*2].vl+=st[x].lzyl;
		st[x*2+1].vl+=st[x].lzyl;
		st[x*2].lzyl+=st[x].lzyl;
		st[x*2+1].lzyl+=st[x].lzyl;
		st[x].lzyl=0;
		st[x*2].vr+=st[x].lzyr;
		st[x*2+1].vr+=st[x].lzyr;
		st[x*2].lzyr+=st[x].lzyr;
		st[x*2+1].lzyr+=st[x].lzyr;
		st[x].lzyr=0;
	}
	void build(int x,int l,int r) {
		if (l==r) {
			st[x].vl=a[l]-sum::get(1,l-1);
			st[x].vr=a[l]-sum::get(l+1,N-1);
			st[x].lzyl=0;
			st[x].lzyr=0;
			return;
		}
		int mid=l+r>>1;
		build(x*2,l,mid);
		build(x*2+1,mid+1,r);
		pull(x);
	}
	void modifyL(int x,int l,int r,int ql,int qr,ll v) {
		if (l>r||l>qr||r<ql||ql>qr) {
			return;
		}
		if (ql<=l&&r<=qr) {
			st[x].lzyl+=v;
			st[x].vl+=v;
			push(x);
			return;
		}
		push(x);
		int mid=l+r>>1;
		modifyL(x*2,l,mid,ql,qr,v);
		modifyL(x*2+1,mid+1,r,ql,qr,v);
		pull(x);
	}
	void modifyR(int x,int l,int r,int ql,int qr,ll v) {
		if (l>r||l>qr||r<ql||ql>qr) {
			return;
		}
		if (ql<=l&&r<=qr) {
			st[x].lzyr+=v;
			st[x].vr+=v;
			push(x);
			return;
		}
		push(x);
		int mid=l+r>>1;
		modifyR(x*2,l,mid,ql,qr,v);
		modifyR(x*2+1,mid+1,r,ql,qr,v);
		pull(x);
	}
	node query(int x,int l,int r,int ql,int qr) {
		if (l>r||l>qr||r<ql||ql>qr) {
			return node(-inf*1ll*inf,-inf*1ll*inf,0ll,0ll);
		}
		if (ql<=l&&r<=qr) {
			return st[x];
		}
		push(x);
		int mid=l+r>>1;
		node qvl=query(x*2,l,mid,ql,qr);
		node qvr=query(x*2+1,mid+1,r,ql,qr);
		pull(x);
		return mrg(qvl,qvr);
	}
	int walkL(int x,int l,int r,int ql,int qr,ll ft) {
		if (l>qr||st[x].vr+ft<=0) return -1;
		if (l==r) {
			return l;
		}
		push(x);
		int res=-1;
		int mid=l+r>>1;
		if (r<=qr) {
			if (st[x*2+1].vr+ft>0) res=walkL(x*2+1,mid+1,r,ql,qr,ft);
			else res=walkL(x*2,l,mid,ql,qr,ft);
		} else {
			res=walkL(x*2+1,mid+1,r,ql,qr,ft);
			if (res==-1) {
				res=walkL(x*2,l,mid,ql,qr,ft);
			}
		}
		pull(x);
		return res;
	}
	int walkR(int x,int l,int r,int ql,int qr,ll ft) {
		if (r<ql||st[x].vl+ft<=0) return -1;
		if (l==r) {
			return l;
		}
		push(x);
		int res=-1;
		int mid=l+r>>1;
		if (l>=ql) {
			if (st[x*2].vl+ft>0) res=walkR(x*2,l,mid,ql,qr,ft);
			else res=walkR(x*2+1,mid+1,r,ql,qr,ft);
		} else {
			res=walkR(x*2,l,mid,ql,qr,ft);
			if (res==-1) {
				res=walkR(x*2+1,mid+1,r,ql,qr,ft);
			}
		}
		pull(x);
		return res;
	}
};

void build() {
	cnt::build(1,1,n);
	rep(i,1,n+1) {
		sum::modify(i,a[i]);
	}
	pref::build(1,1,n);
	stack<int> stk;
	rep(i,1,n+1) {
		while (SZ(stk)>0&&a[i]>a[stk.top()]) {
			int L=stk.top();
			int R=i;
			if (L!=R-1&&min(a[L],a[R])>sum::get(L+1,R-1)) {
				segs::add(1,1,n,L,R,mp(L,R));
				cnt::add(1,1,n,L+1,R-1,1);
			}
			stk.pop();
		}
		stk.push(i);
	}
	while (SZ(stk)) stk.pop();
	per(i,1,n+1) {
		while (SZ(stk)>0&&a[i]>=a[stk.top()]) {
			int L=i;
			int R=stk.top();
			if (L!=R-1&&min(a[L],a[R])>sum::get(L+1,R-1)) {
				segs::add(1,1,n,L,R,mp(L,R));
				cnt::add(1,1,n,L+1,R-1,1);
			}
			stk.pop();
		}
		stk.push(i);
	}
}

int main() {
	scanf("%d",&n);
	rep(i,1,n+1) {
		scanf("%d",&a[i]);
	}
	build();
	scanf("%d",&q);
	while (q--) {
		int op;
		scanf("%d",&op);
		if (op==1) {
			int i,x;
			scanf("%d%d",&i,&x);
			sum::modify(i,-a[i]);
			sum::modify(i,x);
			pref::modifyL(1,1,n,i,i,-a[i]+x);
			pref::modifyR(1,1,n,i,i,-a[i]+x);
			if (i!=n) pref::modifyL(1,1,n,i+1,n,a[i]-x);
			if (i!=1) pref::modifyR(1,1,n,1,i-1,a[i]-x);
			a[i]=x;
			my.clear();
			segs::dfs(1,1,n,i);
			for (auto& p:my) {
				if (min(a[p.fi],a[p.se])>sum::get(p.fi+1,p.se-1)) {
					segs::add(1,1,n,p.fi,p.se,p);
					cnt::add(1,1,n,p.fi+1,p.se-1,1);
				}
			}
			VI L(1,i),R(1,i);
			{
				ll ft=sum::get(i,n);
				int cur=i-1;
				while (cur>0&&pref::query(1,1,n,1,cur).vr+ft>0) {
					int pos=pref::walkL(1,1,n,1,cur,ft);
					/* int low=1,high=cur,pos=cur;
					while (low<=high) {
						int mid=low+high>>1;
						if (pref::query(1,1,n,mid,cur).vr+ft>0) {
							pos=mid;
							low=mid+1;
						} else {
							high=mid-1;
						}
					} */
					L.pb(pos);
					cur=pos-1;
				}
			}
			{
				ll ft=sum::get(1,i);
				int cur=i+1;
				while (cur<=n&&pref::query(1,1,n,cur,n).vl+ft>0) {
					int pos=pref::walkR(1,1,n,cur,n,ft);
					/* int low=cur,high=n,pos=cur;
					while (low<=high) {
						int mid=low+high>>1;
						if (pref::query(1,1,n,cur,mid).vl+ft>0) {
							pos=mid;
							high=mid-1;
						} else {
							low=mid+1;
						}
					}  */
					R.pb(pos);
					cur=pos+1;
				}
			}
			//rep(j,1,i) if (a[j]>sum::get(j+1,i-1)) L.pb(j);
			//rep(j,i+1,n+1) if (a[j]>sum::get(i+1,j-1)) R.pb(j);
			for (int x:L) {
				for (int y:R) {
					if (x+1<y&&min(a[x],a[y])>sum::get(x+1,y-1)) {
						segs::add(1,1,n,x,y,mp(x,y));
						cnt::add(1,1,n,x+1,y-1,1);
					}
				}
			}
		} else {
			int l,r;
			scanf("%d%d",&l,&r);
			{
				int low=l,high=r,pos=l;
				while (low<=high) {
					int mid=low+high>>1;
					if (pref::query(1,1,n,mid,r).vl+sum::get(1,l-1)>0) {
						pos=mid;
						low=mid+1;
					} else {
						high=mid-1;
					}
				}
				l=pos;
			}
			{
				int low=l,high=r,pos=r;
				while (low<=high) {
					int mid=low+high>>1;
					if (pref::query(1,1,n,l,mid).vr+sum::get(r+1,n)>0) {
						pos=mid;
						high=mid-1;
					} else {
						low=mid+1;
					}
				}
				r=pos;
			}
			//printf("-- %d %d --\n",l,r);
			printf("%d\n",cnt::sol(l,r));
		}
	}
}

Compilation message

fish2.cpp: In function 'void cnt::build(int, int, int)':
fish2.cpp:72:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   72 |   int mid=l+r>>1;
      |           ~^~
fish2.cpp: In function 'void cnt::add(int, int, int, int, int, int)':
fish2.cpp:88:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   88 |   int mid=l+r>>1;
      |           ~^~
fish2.cpp: In function 'PII cnt::query(int, int, int, int, int)':
fish2.cpp:101:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  101 |   int mid=l+r>>1;
      |           ~^~
fish2.cpp: In function 'void segs::add(int, int, int, int, int, PII)':
fish2.cpp:126:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  126 |   int mid=l+r>>1;
      |           ~^~
fish2.cpp: In function 'void segs::dfs(int, int, int, int)':
fish2.cpp:153:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  153 |   int mid=l+r>>1;
      |           ~^~
fish2.cpp: In function 'void pref::build(int, int, int)':
fish2.cpp:197:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  197 |   int mid=l+r>>1;
      |           ~^~
fish2.cpp: In function 'void pref::modifyL(int, int, int, int, int, ll)':
fish2.cpp:213:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  213 |   int mid=l+r>>1;
      |           ~^~
fish2.cpp: In function 'void pref::modifyR(int, int, int, int, int, ll)':
fish2.cpp:229:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  229 |   int mid=l+r>>1;
      |           ~^~
fish2.cpp: In function 'pref::node pref::query(int, int, int, int, int)':
fish2.cpp:242:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  242 |   int mid=l+r>>1;
      |           ~^~
fish2.cpp: In function 'int pref::walkL(int, int, int, int, int, ll)':
fish2.cpp:255:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  255 |   int mid=l+r>>1;
      |           ~^~
fish2.cpp: In function 'int pref::walkR(int, int, int, int, int, ll)':
fish2.cpp:275:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  275 |   int mid=l+r>>1;
      |           ~^~
fish2.cpp: In function 'int main()':
fish2.cpp:407:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  407 |      int mid=low+high>>1;
      |              ~~~^~~~~
fish2.cpp:420:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  420 |      int mid=low+high>>1;
      |              ~~~^~~~~
fish2.cpp:325:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  325 |  scanf("%d",&n);
      |  ~~~~~^~~~~~~~~
fish2.cpp:327:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  327 |   scanf("%d",&a[i]);
      |   ~~~~~^~~~~~~~~~~~
fish2.cpp:330:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  330 |  scanf("%d",&q);
      |  ~~~~~^~~~~~~~~
fish2.cpp:333:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  333 |   scanf("%d",&op);
      |   ~~~~~^~~~~~~~~~
fish2.cpp:336:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  336 |    scanf("%d%d",&i,&x);
      |    ~~~~~^~~~~~~~~~~~~~
fish2.cpp:403:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
  403 |    scanf("%d%d",&l,&r);
      |    ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 49756 KB Output is correct
2 Correct 9 ms 49956 KB Output is correct
3 Correct 8 ms 49756 KB Output is correct
4 Correct 8 ms 49752 KB Output is correct
5 Correct 12 ms 49752 KB Output is correct
6 Correct 10 ms 49752 KB Output is correct
7 Correct 12 ms 49752 KB Output is correct
8 Correct 11 ms 49756 KB Output is correct
9 Correct 11 ms 49752 KB Output is correct
10 Correct 10 ms 50008 KB Output is correct
11 Correct 10 ms 49752 KB Output is correct
12 Correct 11 ms 49756 KB Output is correct
13 Correct 11 ms 49752 KB Output is correct
14 Correct 10 ms 49756 KB Output is correct
15 Correct 12 ms 49752 KB Output is correct
16 Correct 10 ms 49752 KB Output is correct
17 Correct 11 ms 49752 KB Output is correct
18 Correct 11 ms 49752 KB Output is correct
19 Correct 11 ms 49752 KB Output is correct
20 Correct 11 ms 49752 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 49752 KB Output is correct
2 Correct 84 ms 64336 KB Output is correct
3 Correct 75 ms 63056 KB Output is correct
4 Correct 82 ms 64080 KB Output is correct
5 Correct 81 ms 63060 KB Output is correct
6 Correct 53 ms 59216 KB Output is correct
7 Correct 41 ms 57680 KB Output is correct
8 Correct 53 ms 59220 KB Output is correct
9 Correct 47 ms 57684 KB Output is correct
10 Correct 64 ms 59984 KB Output is correct
11 Correct 51 ms 59496 KB Output is correct
12 Correct 49 ms 58700 KB Output is correct
13 Correct 48 ms 58780 KB Output is correct
14 Correct 77 ms 61284 KB Output is correct
15 Correct 66 ms 61180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 49756 KB Output is correct
2 Correct 9 ms 49956 KB Output is correct
3 Correct 8 ms 49756 KB Output is correct
4 Correct 8 ms 49752 KB Output is correct
5 Correct 12 ms 49752 KB Output is correct
6 Correct 10 ms 49752 KB Output is correct
7 Correct 12 ms 49752 KB Output is correct
8 Correct 11 ms 49756 KB Output is correct
9 Correct 11 ms 49752 KB Output is correct
10 Correct 10 ms 50008 KB Output is correct
11 Correct 10 ms 49752 KB Output is correct
12 Correct 11 ms 49756 KB Output is correct
13 Correct 11 ms 49752 KB Output is correct
14 Correct 10 ms 49756 KB Output is correct
15 Correct 12 ms 49752 KB Output is correct
16 Correct 10 ms 49752 KB Output is correct
17 Correct 11 ms 49752 KB Output is correct
18 Correct 11 ms 49752 KB Output is correct
19 Correct 11 ms 49752 KB Output is correct
20 Correct 11 ms 49752 KB Output is correct
21 Correct 8 ms 49752 KB Output is correct
22 Correct 84 ms 64336 KB Output is correct
23 Correct 75 ms 63056 KB Output is correct
24 Correct 82 ms 64080 KB Output is correct
25 Correct 81 ms 63060 KB Output is correct
26 Correct 53 ms 59216 KB Output is correct
27 Correct 41 ms 57680 KB Output is correct
28 Correct 53 ms 59220 KB Output is correct
29 Correct 47 ms 57684 KB Output is correct
30 Correct 64 ms 59984 KB Output is correct
31 Correct 51 ms 59496 KB Output is correct
32 Correct 49 ms 58700 KB Output is correct
33 Correct 48 ms 58780 KB Output is correct
34 Correct 77 ms 61284 KB Output is correct
35 Correct 66 ms 61180 KB Output is correct
36 Correct 113 ms 65104 KB Output is correct
37 Correct 100 ms 63584 KB Output is correct
38 Correct 91 ms 62288 KB Output is correct
39 Correct 117 ms 65360 KB Output is correct
40 Correct 96 ms 62600 KB Output is correct
41 Correct 67 ms 59148 KB Output is correct
42 Correct 73 ms 59220 KB Output is correct
43 Correct 59 ms 57696 KB Output is correct
44 Correct 57 ms 57684 KB Output is correct
45 Correct 80 ms 61008 KB Output is correct
46 Correct 72 ms 59984 KB Output is correct
47 Correct 54 ms 57432 KB Output is correct
48 Correct 63 ms 58964 KB Output is correct
49 Correct 62 ms 58960 KB Output is correct
50 Correct 77 ms 61520 KB Output is correct
51 Correct 81 ms 61008 KB Output is correct
52 Correct 82 ms 61312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 49752 KB Output is correct
2 Correct 84 ms 64336 KB Output is correct
3 Correct 75 ms 63056 KB Output is correct
4 Correct 82 ms 64080 KB Output is correct
5 Correct 81 ms 63060 KB Output is correct
6 Correct 53 ms 59216 KB Output is correct
7 Correct 41 ms 57680 KB Output is correct
8 Correct 53 ms 59220 KB Output is correct
9 Correct 47 ms 57684 KB Output is correct
10 Correct 64 ms 59984 KB Output is correct
11 Correct 51 ms 59496 KB Output is correct
12 Correct 49 ms 58700 KB Output is correct
13 Correct 48 ms 58780 KB Output is correct
14 Correct 77 ms 61284 KB Output is correct
15 Correct 66 ms 61180 KB Output is correct
16 Correct 9 ms 49752 KB Output is correct
17 Correct 1526 ms 63836 KB Output is correct
18 Correct 1545 ms 65832 KB Output is correct
19 Correct 1584 ms 63788 KB Output is correct
20 Correct 1498 ms 63680 KB Output is correct
21 Correct 1572 ms 63564 KB Output is correct
22 Correct 1607 ms 65636 KB Output is correct
23 Correct 1550 ms 63348 KB Output is correct
24 Correct 1533 ms 64288 KB Output is correct
25 Correct 1540 ms 64104 KB Output is correct
26 Correct 1557 ms 64336 KB Output is correct
27 Correct 1546 ms 60020 KB Output is correct
28 Correct 1583 ms 60344 KB Output is correct
29 Correct 1614 ms 59932 KB Output is correct
30 Correct 1227 ms 57936 KB Output is correct
31 Correct 1196 ms 57680 KB Output is correct
32 Correct 1474 ms 60584 KB Output is correct
33 Correct 1657 ms 60808 KB Output is correct
34 Correct 1596 ms 59736 KB Output is correct
35 Correct 1597 ms 58480 KB Output is correct
36 Correct 1592 ms 61592 KB Output is correct
37 Correct 1399 ms 59736 KB Output is correct
38 Correct 1454 ms 59472 KB Output is correct
39 Correct 1635 ms 61880 KB Output is correct
40 Correct 1793 ms 61716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 49752 KB Output is correct
2 Correct 84 ms 64336 KB Output is correct
3 Correct 75 ms 63056 KB Output is correct
4 Correct 82 ms 64080 KB Output is correct
5 Correct 81 ms 63060 KB Output is correct
6 Correct 53 ms 59216 KB Output is correct
7 Correct 41 ms 57680 KB Output is correct
8 Correct 53 ms 59220 KB Output is correct
9 Correct 47 ms 57684 KB Output is correct
10 Correct 64 ms 59984 KB Output is correct
11 Correct 51 ms 59496 KB Output is correct
12 Correct 49 ms 58700 KB Output is correct
13 Correct 48 ms 58780 KB Output is correct
14 Correct 77 ms 61284 KB Output is correct
15 Correct 66 ms 61180 KB Output is correct
16 Correct 9 ms 49752 KB Output is correct
17 Correct 1590 ms 71552 KB Output is correct
18 Correct 1371 ms 76668 KB Output is correct
19 Correct 1358 ms 72740 KB Output is correct
20 Correct 1498 ms 75404 KB Output is correct
21 Correct 1948 ms 71200 KB Output is correct
22 Correct 1426 ms 76736 KB Output is correct
23 Correct 1615 ms 75704 KB Output is correct
24 Correct 1387 ms 76632 KB Output is correct
25 Correct 1582 ms 74752 KB Output is correct
26 Correct 943 ms 63352 KB Output is correct
27 Correct 771 ms 63912 KB Output is correct
28 Correct 1305 ms 68332 KB Output is correct
29 Correct 853 ms 63416 KB Output is correct
30 Correct 755 ms 64184 KB Output is correct
31 Correct 1224 ms 69480 KB Output is correct
32 Correct 1288 ms 73964 KB Output is correct
33 Correct 791 ms 71032 KB Output is correct
34 Correct 1376 ms 74984 KB Output is correct
35 Correct 717 ms 62032 KB Output is correct
36 Correct 1327 ms 72736 KB Output is correct
37 Correct 1299 ms 69600 KB Output is correct
38 Correct 1256 ms 67040 KB Output is correct
39 Correct 1088 ms 66636 KB Output is correct
40 Correct 1197 ms 64480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 49756 KB Output is correct
2 Correct 9 ms 49956 KB Output is correct
3 Correct 8 ms 49756 KB Output is correct
4 Correct 8 ms 49752 KB Output is correct
5 Correct 12 ms 49752 KB Output is correct
6 Correct 10 ms 49752 KB Output is correct
7 Correct 12 ms 49752 KB Output is correct
8 Correct 11 ms 49756 KB Output is correct
9 Correct 11 ms 49752 KB Output is correct
10 Correct 10 ms 50008 KB Output is correct
11 Correct 10 ms 49752 KB Output is correct
12 Correct 11 ms 49756 KB Output is correct
13 Correct 11 ms 49752 KB Output is correct
14 Correct 10 ms 49756 KB Output is correct
15 Correct 12 ms 49752 KB Output is correct
16 Correct 10 ms 49752 KB Output is correct
17 Correct 11 ms 49752 KB Output is correct
18 Correct 11 ms 49752 KB Output is correct
19 Correct 11 ms 49752 KB Output is correct
20 Correct 11 ms 49752 KB Output is correct
21 Correct 8 ms 49752 KB Output is correct
22 Correct 84 ms 64336 KB Output is correct
23 Correct 75 ms 63056 KB Output is correct
24 Correct 82 ms 64080 KB Output is correct
25 Correct 81 ms 63060 KB Output is correct
26 Correct 53 ms 59216 KB Output is correct
27 Correct 41 ms 57680 KB Output is correct
28 Correct 53 ms 59220 KB Output is correct
29 Correct 47 ms 57684 KB Output is correct
30 Correct 64 ms 59984 KB Output is correct
31 Correct 51 ms 59496 KB Output is correct
32 Correct 49 ms 58700 KB Output is correct
33 Correct 48 ms 58780 KB Output is correct
34 Correct 77 ms 61284 KB Output is correct
35 Correct 66 ms 61180 KB Output is correct
36 Correct 113 ms 65104 KB Output is correct
37 Correct 100 ms 63584 KB Output is correct
38 Correct 91 ms 62288 KB Output is correct
39 Correct 117 ms 65360 KB Output is correct
40 Correct 96 ms 62600 KB Output is correct
41 Correct 67 ms 59148 KB Output is correct
42 Correct 73 ms 59220 KB Output is correct
43 Correct 59 ms 57696 KB Output is correct
44 Correct 57 ms 57684 KB Output is correct
45 Correct 80 ms 61008 KB Output is correct
46 Correct 72 ms 59984 KB Output is correct
47 Correct 54 ms 57432 KB Output is correct
48 Correct 63 ms 58964 KB Output is correct
49 Correct 62 ms 58960 KB Output is correct
50 Correct 77 ms 61520 KB Output is correct
51 Correct 81 ms 61008 KB Output is correct
52 Correct 82 ms 61312 KB Output is correct
53 Correct 9 ms 49752 KB Output is correct
54 Correct 1526 ms 63836 KB Output is correct
55 Correct 1545 ms 65832 KB Output is correct
56 Correct 1584 ms 63788 KB Output is correct
57 Correct 1498 ms 63680 KB Output is correct
58 Correct 1572 ms 63564 KB Output is correct
59 Correct 1607 ms 65636 KB Output is correct
60 Correct 1550 ms 63348 KB Output is correct
61 Correct 1533 ms 64288 KB Output is correct
62 Correct 1540 ms 64104 KB Output is correct
63 Correct 1557 ms 64336 KB Output is correct
64 Correct 1546 ms 60020 KB Output is correct
65 Correct 1583 ms 60344 KB Output is correct
66 Correct 1614 ms 59932 KB Output is correct
67 Correct 1227 ms 57936 KB Output is correct
68 Correct 1196 ms 57680 KB Output is correct
69 Correct 1474 ms 60584 KB Output is correct
70 Correct 1657 ms 60808 KB Output is correct
71 Correct 1596 ms 59736 KB Output is correct
72 Correct 1597 ms 58480 KB Output is correct
73 Correct 1592 ms 61592 KB Output is correct
74 Correct 1399 ms 59736 KB Output is correct
75 Correct 1454 ms 59472 KB Output is correct
76 Correct 1635 ms 61880 KB Output is correct
77 Correct 1793 ms 61716 KB Output is correct
78 Correct 9 ms 49752 KB Output is correct
79 Correct 1590 ms 71552 KB Output is correct
80 Correct 1371 ms 76668 KB Output is correct
81 Correct 1358 ms 72740 KB Output is correct
82 Correct 1498 ms 75404 KB Output is correct
83 Correct 1948 ms 71200 KB Output is correct
84 Correct 1426 ms 76736 KB Output is correct
85 Correct 1615 ms 75704 KB Output is correct
86 Correct 1387 ms 76632 KB Output is correct
87 Correct 1582 ms 74752 KB Output is correct
88 Correct 943 ms 63352 KB Output is correct
89 Correct 771 ms 63912 KB Output is correct
90 Correct 1305 ms 68332 KB Output is correct
91 Correct 853 ms 63416 KB Output is correct
92 Correct 755 ms 64184 KB Output is correct
93 Correct 1224 ms 69480 KB Output is correct
94 Correct 1288 ms 73964 KB Output is correct
95 Correct 791 ms 71032 KB Output is correct
96 Correct 1376 ms 74984 KB Output is correct
97 Correct 717 ms 62032 KB Output is correct
98 Correct 1327 ms 72736 KB Output is correct
99 Correct 1299 ms 69600 KB Output is correct
100 Correct 1256 ms 67040 KB Output is correct
101 Correct 1088 ms 66636 KB Output is correct
102 Correct 1197 ms 64480 KB Output is correct
103 Correct 1418 ms 73292 KB Output is correct
104 Correct 1357 ms 76412 KB Output is correct
105 Correct 1604 ms 66876 KB Output is correct
106 Correct 1737 ms 70680 KB Output is correct
107 Correct 1683 ms 75552 KB Output is correct
108 Correct 1336 ms 76556 KB Output is correct
109 Correct 1634 ms 68648 KB Output is correct
110 Correct 1769 ms 73652 KB Output is correct
111 Correct 1583 ms 67656 KB Output is correct
112 Correct 1731 ms 70336 KB Output is correct
113 Correct 1022 ms 63700 KB Output is correct
114 Correct 1479 ms 62588 KB Output is correct
115 Correct 1334 ms 69756 KB Output is correct
116 Correct 1480 ms 67592 KB Output is correct
117 Correct 1441 ms 62856 KB Output is correct
118 Correct 1624 ms 63088 KB Output is correct
119 Correct 835 ms 64024 KB Output is correct
120 Correct 1424 ms 69116 KB Output is correct
121 Correct 1682 ms 66216 KB Output is correct
122 Correct 1453 ms 74244 KB Output is correct
123 Correct 1081 ms 62060 KB Output is correct
124 Correct 1655 ms 68052 KB Output is correct
125 Correct 1460 ms 61108 KB Output is correct
126 Correct 1589 ms 66248 KB Output is correct
127 Correct 1334 ms 69712 KB Output is correct
128 Correct 1554 ms 63060 KB Output is correct
129 Correct 1216 ms 66472 KB Output is correct
130 Correct 1662 ms 64660 KB Output is correct