# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
133596 | 2019-07-21T06:04:26 Z | ckodser | 말 (IOI15_horses) | C++14 | 461 ms | 40640 KB |
#include "horses.h" #include<bits/stdc++.h> #define ll long long #define pb push_back #define ld long double #define mp make_pair #define F first #define S second #define pii pair<ll,ll> using namespace :: std; const ll maxn=5e5+500; const ll inf=1e9+6; const ll mod=1e9+7; ll modizarb(long long a,long long b){return (a*b)%mod;} ll y[maxn]; void bild(ll l,ll r,ll node){ } void update(ll l,ll r,ll node,ll pos){ } ll findMx(ll l,ll r,ll L,ll R,ll node){ ll ans=0; for(ll i=l;i<r;i++){ ans=max(ans,y[i]); } return ans; } set<ll> st; ll x[maxn]; ll rx[maxn]; ll n,Z; ll poww(ll a,ll b){ ll ans=1; while(b){ if(b&1){ ans=(ans*a)%mod; } b>>=1; a=(a*a)%mod; } return ans; } ll findAns(){ auto it=st.end(); ll last=n; ll ans=0; ll t=Z; while(it!=st.begin()){ it--; ll v=(*it); ll yy=findMx(v,last,0,n,1); ans=max(ans,yy); if(ans*x[v]>inf)break; ans*=x[v]; t=modizarb(t,rx[v]); last=v; } return modizarb(ans,t); } int init(int N, int X[], int Y[]){ n=N; Z=1; for(ll i=0;i<n;i++){ x[i]=X[i]; Z=modizarb(Z,X[i]); rx[i]=poww(x[i],mod-2); y[i]=Y[i]; if(x[i]!=1)st.insert(i); st.insert(i); } bild(0,n,1); return findAns(); } int updateX(int pos, int val) { Z=modizarb(Z,rx[pos]); if(x[pos]!=1 && val==1){ st.erase(pos); } if(x[pos]==1 && val!=1){ st.insert(pos); } x[pos]=val; Z=modizarb(Z,val); rx[pos]=poww(x[pos],mod-2); return findAns(); } int updateY(int pos, int val){ y[pos]=val; update(0,n,1,pos); return findAns(); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 380 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 380 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 380 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 296 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 2 ms | 376 KB | Output is correct |
22 | Correct | 2 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 504 KB | Output is correct |
24 | Correct | 3 ms | 504 KB | Output is correct |
25 | Correct | 3 ms | 504 KB | Output is correct |
26 | Correct | 3 ms | 504 KB | Output is correct |
27 | Correct | 5 ms | 548 KB | Output is correct |
28 | Correct | 3 ms | 376 KB | Output is correct |
29 | Correct | 11 ms | 376 KB | Output is correct |
30 | Incorrect | 3 ms | 504 KB | Output isn't correct |
31 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 422 ms | 40412 KB | Output is correct |
2 | Correct | 461 ms | 40568 KB | Output is correct |
3 | Correct | 458 ms | 40524 KB | Output is correct |
4 | Correct | 461 ms | 40640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 376 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 2 ms | 376 KB | Output is correct |
22 | Correct | 2 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 504 KB | Output is correct |
24 | Correct | 3 ms | 504 KB | Output is correct |
25 | Correct | 3 ms | 504 KB | Output is correct |
26 | Correct | 3 ms | 504 KB | Output is correct |
27 | Correct | 5 ms | 504 KB | Output is correct |
28 | Correct | 3 ms | 376 KB | Output is correct |
29 | Correct | 12 ms | 376 KB | Output is correct |
30 | Incorrect | 4 ms | 504 KB | Output isn't correct |
31 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 2 ms | 380 KB | Output is correct |
20 | Correct | 2 ms | 376 KB | Output is correct |
21 | Correct | 18 ms | 376 KB | Output is correct |
22 | Correct | 2 ms | 376 KB | Output is correct |
23 | Correct | 3 ms | 376 KB | Output is correct |
24 | Correct | 3 ms | 376 KB | Output is correct |
25 | Correct | 3 ms | 380 KB | Output is correct |
26 | Correct | 3 ms | 376 KB | Output is correct |
27 | Correct | 5 ms | 376 KB | Output is correct |
28 | Correct | 3 ms | 508 KB | Output is correct |
29 | Correct | 11 ms | 376 KB | Output is correct |
30 | Incorrect | 3 ms | 504 KB | Output isn't correct |
31 | Halted | 0 ms | 0 KB | - |