QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#400452 | #4894. 学姐买瓜 | Butanlishi | 0 | 0ms | 0kb | C++14 | 1.3kb | 2024-04-27 11:56:47 | 2024-04-27 11:56:48 |
answer
#include<bits/stdc++.h>
#define ll long long
#define rg int
#define ci const int
#define ls x<<1
#define rs x<<1|1
#define mid ((l+r)>>1)
#define ld long double
#define fo(i,l,r) for(int i=(l);i<=(r);++i)
#define fd(i,l,r) for(int i=(l);i>=(r);--i)
#define fu(i,l,r) for(int i=(l);i<(r);++i)
#define gcd __gcd
#define P(x) __builtin_popcountll(x)
using namespace std;
ci N=2e5+5,M=5e3+5,mod=998244353,_g=3,_ig=(mod+1)/3;
ll ksm(ll a,ll b=mod-2)
{
ll ans=1;
while(b)
{
if(b&1)ans=(ll)ans*a%mod;
a=(ll)a*a%mod,b>>=1;
}
return ans;
}
const ld eps=1e-10;
inline ll read(){ll u,f=1;char o;while((o=getchar())<48||o>57)if(o==45)f=-1;u=(o^48);while((o=getchar())>=48&&o<=57)u=(u<<1)+(u<<3)+(o^48);return u*f;}
void write(ll x){if(x<0)putchar(45),x=-x;if(x>9)write(x/10);putchar(x%10+48);}
ll n,m,a[N],f[N];
vector<ll>w[N];
int main()
{//freopen("1.in","r",stdin);
// freopen("gua.in","r",stdin);
int T=1;
while(T--)
{
n=read();m=read();
while(m--)
{
int op=read();ll x=read(),y=read();
if(op==1)
{
w[y].push_back(x);
}
else
{
f[x-1]=0;
ll s=0;
fo(i,x,y)
{
for(auto d:w[i])if(d>=x)
{
s=max(s,f[d-1]+1);
}
f[i]=s;
}
cout<<s<<'\n';
}
}
}
return 0;
}
详细
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 0
Time Limit Exceeded
input:
11 13 2 4 4 1 11 12 1 1 5 1 2 3 1 2 10 2 2 8 1 6 6 2 2 10 1 6 11 2 2 3 2 2 13
output:
result:
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #2:
0%