ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#212283 | #3811. T1 | lqw | 0 | 7ms | 1256kb | C++ | 1.5kb | 2024-10-13 17:36:11 | 2024-10-13 19:38:19 |
answer
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll al[1000010],ac[1000010];
ll bl[1000010],bc[1000010];
ll find(ll a[],ll x,ll n) {
ll l=0,r=n;
ll mid=(l+r)>>2;
while(l<r){
if(a[mid]>x)r=mid;
else l=mid+1;
mid=l+r;
mid>>=1;
}
return mid;
}
void insertt(ll a[],ll &x,ll &n,ll &k) {
for(int i=n;i>k;i--){
a[i]=a[i-1];
}
a[k]=x;
n++;
}
void erasee(ll a[],ll &n,ll &k) {
k-=1;
for(int i=k;i<n;i++){
a[i]=a[i+1];
}
n--;
}
ll nc,nl,t;
int main(){
// cin>>cnt;
// for(ll i=0;i<cnt;i++){
// ll x;
// cin>>x;
// ll k=find(ac,x,n);
// insertt(ac,x,n,k);
// }
// for(ll i=0;i<n;i++){
// cout<<ac[i]<<" ";
// }
// cin>>cnt;
// for(ll i=0;i<cnt;i++){
// ll x;
// cin>>x;
// cout<<find(ac,x,n)<<endl;
// }
// cin>>cnt;
// for(ll i=0;i<cnt;i++){
// ll x;
// cin>>x;
// ll k=find(ac,x,n);
// erasee(ac,n,k);
// for(ll i=0;i<n;i++){
// cout<<ac[i]<<" ";
// }
// cout<<endl;
// }
scanf("%d",&t);
while(t--){
bool o;
ll a,d,b;
cin>>o>>d>>a>>b;
if(d==0){
ll k1=find(al,a,nl);
ll k2=find(bl,b,nl);
if(o==1){
insertt(al,a,nl,k1);
insertt(bl,b,nl,k2);
}
else {
erasee(al,nl,k1);
erasee(bl,nl,k2);
}
}
else {
ll k1=find(ac,a,nc);
ll k2=find(bc,b,nc);
if(o==1){
insertt(ac,a,nc,k1);
insertt(bc,b,nc,k2);
}
else {
erasee(ac,nc,k1);
erasee(bc,nc,k2);
}
}
if(nl==0||nc==0)printf("-1\n");
else {
printf("%d\n",min(ac[0]+al[0],bc[0]+bc[0]));
}
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 1248kb
input:
100 1 0 30056910 791979446 0 0 30056910 791979446 1 1 87818006 915325879 1 0 885405412 638527154 0 1...
output:
-1 -1 -1 973223418 -1 -1 -1 1131728154 605463581 605463581 306573433 306573433 605463581 -1 -1 -1 13...
result:
wrong answer 4th numbers differ - expected: '1553853033', found: '973223418'
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 1248kb
input:
100 1 0 888145469 920169409 1 0 452904566 455699108 1 0 9314511 72429163 0 0 452904566 455699108 1 1...
output:
-1 -1 -1 -1 560615725 282138824 282138824 560615725 560615725 615329710 619883604 619883604 61988360...
result:
wrong answer 6th numbers differ - expected: '560615725', found: '282138824'
Subtask #3:
score: 0
Wrong Answer
Test #3:
score: 0
Wrong Answer
time: 3ms
memory: 1256kb
input:
1000 1 0 434052041 886975755 1 0 5735137 42531708 1 0 333067530 62734547 0 0 434052041 886975755 1 1...
output:
-1 -1 -1 -1 695609063 34873076 34873076 34873076 34873076 355187626 -1 -1 318043800 318043800 318043...
result:
wrong answer 5th numbers differ - expected: '839243210', found: '695609063'
Subtask #4:
score: 0
Wrong Answer
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 1256kb
input:
1000 1 1 99608765 102738517 1 0 409526489 651778959 1 1 632469167 447766999 1 1 596595729 295223176 ...
output:
-1 205477034 205477034 205477034 205477034 205477034 205477034 205477034 205477034 205477034 2054770...
result:
wrong answer 2nd numbers differ - expected: '754517476', found: '205477034'
Subtask #5:
score: 0
Wrong Answer
Test #5:
score: 0
Wrong Answer
time: 2ms
memory: 1252kb
input:
1000 1 1 392884476 341683390 1 1 812391583 884023296 0 1 392884476 341683390 0 1 812391583 884023296...
output:
-1 -1 -1 -1 -1 -1 -1 231058716 -1 -1 59601186 59601186 44505975 44505975 44505975 44505975 44505975 ...
result:
wrong answer 8th numbers differ - expected: '1033130556', found: '231058716'
Subtask #6:
score: 0
Time Limit Exceeded
Test #6:
score: 0
Time Limit Exceeded
input:
200000 1 0 745208991 893565181 1 1 338915529 332862800 1 1 879402360 343669571 0 0 745208991 8935651...
output:
-1 665725600 665725600 -1 665725600 665725600 665725600 665725600 665725600 665725600 665725600 6657...
result:
Subtask #7:
score: 0
Time Limit Exceeded
Test #7:
score: 0
Time Limit Exceeded
input:
200000 1 0 61288090 442363511 1 0 702180888 491607485 0 0 702180888 491607485 0 0 61288090 442363511...
output:
-1 -1 -1 -1 -1 1032640173 120236490 120236490 -1 120236490 120236490 120236490 120236490 120236490 1...
result:
Subtask #8:
score: 0
Time Limit Exceeded
Test #8:
score: 0
Time Limit Exceeded
input:
200000 1 0 965089945 885763418 1 0 47734550 558904612 0 0 47734550 558904612 1 0 511007140 115554736...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2834160 2834160 2834160 2834160 2834160 2834160 2834160 2834160 283...
result:
Subtask #9:
score: 0
Time Limit Exceeded
Test #9:
score: 0
Time Limit Exceeded
input:
1000000 1 1 598963903 48224788 1 0 880787238 21153517 1 0 874812562 609964051 0 1 598963903 48224788...
output:
-1 96449576 96449576 -1 -1 1290831270 1290831270 1290831270 1290831270 1166765010 820471162 82047116...
result:
Subtask #10:
score: 0
Time Limit Exceeded
Test #10:
score: 0
Time Limit Exceeded
input:
1000000 1 0 532848699 733617288 1 1 59884418 599409867 0 1 59884418 599409867 1 0 1137393 496603003 ...
output:
-1 592733117 -1 -1 172046072 703757378 703757378 703757378 703757378 566601287 703757378 250411758 2...