QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#503648 | #3272. 简单数据结构 | Crying | 20 | 6ms | 16004kb | C++14 | 1.6kb | 2024-08-03 21:48:52 | 2024-08-03 21:48:52 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll; typedef array<ll,2> pr;
const int MAXN = 2e5+10;
int n,q; ll a[MAXN];
int o[MAXN]; ll x[MAXN],y[MAXN];
pr arr[MAXN]; int rk[MAXN],num;
vector<int> mdf[MAXN];
namespace T{ //求出每个位置从何时开始被影响到
void solve(){
for(int i=1,cnt=0;i<=q;i++){
if(o[i] == 2)cnt++;
else if(o[i] == 1)arr[++num] = (pr){x[i],cnt},rk[num] = i;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=num;j++){
ll d = i*arr[j][1] + a[i] - arr[j][0];
if(d > 0){
mdf[rk[j]].push_back(i);
break;
}
}
}
}
}
int vis[MAXN]; ll va[MAXN],vb[MAXN];
int main(){
ios::sync_with_stdio(false); cin.tie(0);
cin>>n>>q;
for(int i=1;i<=n;i++)cin>>a[i];
for(int i=1;i<=q;i++){
cin>>o[i];
if(o[i] == 1){
cin>>x[i];
}else if(o[i] == 3){
cin>>x[i]>>y[i];
}
}
T::solve();
for(int i=1;i<=q;i++){
if(o[i] == 1){
for(int j=n;j>=1;j--)if(vis[j]){
if(va[j] > x[i])va[j] = x[i];
else break;
}
for(auto j : mdf[i]){
vis[j] = 1; va[j] = x[i];
}
}else if(o[i] == 2){
for(int j=1;j<=n;j++)vis[j] ? va[j]+=j : vb[j]+=j;
}else{
ll sum = 0;
for(int j=x[i];j<=y[i];j++)sum += (vis[j] ? va[j] : vb[j]);
cout<<sum<<"\n";
}
}
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 6ms
memory: 16004kb
input:
5000 5000 29940 259997 53132 912489 608312 594283 432259 344137 889466 383028 320097 337418 571199 372832 563110 542407 133378 998389 238387 120880 477310 634888 191990 133585 935315 558139 141724 893331 190118 991968 843042 384930 935256 891482 123419 91431 955722 376987 197566 106433 234494 645967...
output:
289016717 250045728 72480278 337470463 282546421 44572861 232690069 290703291 216329572 41091612 333437301 332818277 177902042 2124609 274761796 218650401 20701276 108731586 22089646 34631220 55848925 92356740 36949030 86469096 43484249 50829332 1334865 76063265 114623436 13564322 79974466 15230088 ...
result:
wrong answer 1st numbers differ - expected: '512185934', found: '289016717'
Subtask #2:
score: 20
Accepted
Subtask #3:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 5ms
memory: 14008kb
input:
5000 5000 29940 259997 53132 912489 608312 594283 432259 344137 889466 383028 320097 337418 571199 372832 563110 542407 133378 998389 238387 120880 477310 634888 191990 133585 935315 558139 141724 893331 190118 991968 843042 384930 935256 891482 123419 91431 955722 376987 197566 106433 234494 645967...
output:
289016717 250045728 72480278 337470463 282546421 44572861 232690069 290703291 216329572 41091612 333437301 332818277 177902042 2124609 274761796 218650401 20701276 108731586 22089646 34631220 55848925 92356740 36949030 86469096 43484249 50829332 1334865 76063265 114623436 13564322 79974466 15230088 ...
result:
wrong answer 1st numbers differ - expected: '512185934', found: '289016717'
Subtask #4:
score: 0
Skipped
Dependency #1:
0%