QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#831165#8907. КонференцияXY_Eleven5 24ms6184kbC++204.5kb2024-12-25 11:23:342024-12-25 11:23:35

Judging History

你现在查看的是最新测评结果

  • [2024-12-25 11:23:35]
  • 评测
  • 测评结果:5
  • 用时:24ms
  • 内存:6184kb
  • [2024-12-25 11:23:34]
  • 提交

answer

#include <bits/stdc++.h>
// #include <windows.h>
// #include <bits/extc++.h>
// using namespace __gnu_pbds;
using namespace std;
//#pragma GCC optimize(3)
#define DB double
#define LL long long
#define ULL unsigned long long
#define in128 __int128
#define cint const int
#define cLL const LL
#define For(z,e1,e2) for(int z=(e1);z<=(e2);z++)
#define Rof(z,e1,e2) for(int z=(e2);z>=(e1);z--)
#define For_(z,e1,e2) for(int z=(e1);z<(e2);z++)
#define Rof_(z,e1,e2) for(int z=(e2);z>(e1);z--)
#define inint(e) scanf("%d",&e)
#define inll(e) scanf("%lld",&e)
#define inpr(e1,e2) scanf("%d%d",&e1,&e2)
#define in3(e1,e2,e3) scanf("%d%d%d",&e1,&e2,&e3)
#define outint(e) printf("%d\n",e)
#define outint_(e) printf("%d%c",e," \n"[i==n])
#define outint2_(e,e1,e2) printf("%d%c",e," \n"[(e1)==(e2)])
#define outll(e) printf("%lld\n",e)
#define outll_(e) printf("%lld%c",e," \n"[i==n])
#define outll2_(e,e1,e2) printf("%lld%c",e," \n"[(e1)==(e2)])
#define exc(e) if(e) continue
#define stop(e) if(e) break
#define ret(e) if(e) return
#define ll(e) (1ll*(e))
#define pb push_back
#define ft first
#define sc second
#define pii pair<int,int> 
#define pli pair<long long,int> 
#define vct vector 
#define clean(e) while(!e.empty()) e.pop()
#define all(ev) ev.begin(),ev.end()
#define sz(ev) ((int)ev.size())
#define debug(x) printf("%s=%d\n",#x,x)
#define x0 __xx00__
#define y1 __yy11__
#define ffo fflush(stdout)
// cLL mod=998244353,G=404;
LL mod;
// cLL mod[2]={1686688681ll,1666888681ll},base[2]={166686661ll,188868881ll};
template <typename Type> void get_min(Type &w1,const Type w2) { if(w2<w1) w1=w2; } template <typename Type> void get_max(Type &w1,const Type w2) { if(w2>w1) w1=w2; }
template <typename Type> Type up_div(Type w1,Type w2) { return (w1/w2+(w1%w2?1:0)); }
template <typename Type> Type gcd(Type X_,Type Y_) { Type R_=X_%Y_; while(R_) { X_=Y_; Y_=R_; R_=X_%Y_; } return Y_; } template <typename Type> Type lcm(Type X_,Type Y_) { return (X_/gcd(X_,Y_)*Y_); }
template <typename Type> Type md(Type w1,const Type w2=mod) { w1%=w2; if(w1<0) w1+=w2; return w1; } template <typename Type> Type md_(Type w1,const Type w2=mod) { w1%=w2; if(w1<=0) w1+=w2; return w1; }
void ex_gcd(LL &X_,LL &Y_,LL A_,LL B_) { if(!B_) { X_=1ll; Y_=0ll; return ; } ex_gcd(Y_,X_,B_,A_%B_); X_=md(X_,B_); Y_=(1ll-X_*A_)/B_; } LL inv(LL A_,LL B_=mod) { LL X_=0ll,Y_=0ll; ex_gcd(X_,Y_,A_,B_); return X_; }
template <typename Type> void add(Type &w1,const Type w2,const Type M_=mod) { w1=md(w1+w2,M_); } void mul(LL &w1,cLL w2,cLL M_=mod) { w1=md(w1*md(w2,M_),M_); } template <typename Type> Type pw(Type X_,Type Y_,Type M_=mod) { Type S_=1; while(Y_) { if(Y_&1) mul(S_,X_,M_); Y_>>=1; mul(X_,X_,M_); } return S_; }
template <typename Type> Type bk(vector <Type> &V_) { auto T_=V_.back(); V_.pop_back(); return T_; } template <typename Type> Type tp(stack <Type> &V_) { auto T_=V_.top(); V_.pop(); return T_; } template <typename Type> Type frt(queue <Type> &V_) { auto T_=V_.front(); V_.pop(); return T_; }
template <typename Type> Type bg(set <Type> &V_) { auto T_=*V_.begin(); V_.erase(V_.begin()); return T_; } template <typename Type> Type bk(set <Type> &V_) { auto T_=*prev(V_.end()); V_.erase(*prev(V_.end())); return T_; }
mt19937 gen(time(NULL)); int rd() { return abs((int)gen()); }
int rnd(int l,int r) { return rd()%(r-l+1)+l; }

void main_init()
{

}
cint W=1000000001;
int n;
vct <array<int,3> > a;
vct <int> work()
{
    sort(all(a),[&](const array<int,3> &w1,const array<int,3> &w2)->bool{return (w1[1]<w2[1]);});
    int lst=-1;
    vct <array<int,3> > b,b2;
    for(auto [l,r,id]:a)
        if(l>lst) b.pb({l,r,id}),lst=r;
        else b2.pb({l,r,id});
    int m=sz(b);
    // outint(m);
    int z1=b[(m>>1)-1][1];
    // printf("%d %d\n",z1,z2);
    vct <int> ans;
    for(auto [l,r,id]:b)
        if(l<=z1) ans.pb(id);
    for(auto [l,r,id]:b2)
        if(l<=z1) ans.pb(id);
    return ans;
}
void main_solve()
{
    inint(n);
    a.resize(n);
    For_(i,0,n) inpr(a[i][0],a[i][1]),a[i][2]=i+1;
    auto ans=work();
    if(sz(ans)<(n>>1))
    {
        for(auto &i:a) i={W-i[1],W-i[0],i[2]};
        ans=work();
    }
    sort(all(ans));
    For_(i,0,n>>1) outint2_(ans[i],i,(n>>1)-1);
}
int main()
{
    // ios::sync_with_stdio(0); cin.tie(0);
    // freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
    // srand(time(NULL));
    main_init();
    int _; inint(_); For(__,1,_) // T>1 ?
        // printf("\n------------\n\n"),
        main_solve();
    return 0;
}
/*

*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 0ms
memory: 3832kb

input:

1
4
823983109 859315505
510901709 589624124
351308325 413158126
29447781 138101981

output:

3 4

result:

ok answers are correct. (1 test case)

Test #2:

score: 5
Accepted
time: 0ms
memory: 3876kb

input:

1
10
344190293 385750493
951894838 978895800
82358344 338131819
540516504 607653166
820688970 951835774
395392706 419489159
623802732 644208366
798160348 818154082
680378878 682083538
467019518 519267671

output:

1 3 4 6 10

result:

ok answers are correct. (1 test case)

Test #3:

score: 5
Accepted
time: 0ms
memory: 3812kb

input:

1
500
943625790 945741848
367933677 368747115
117030592 118328257
321658393 322265356
413440931 413466704
191801051 192382494
45318188 45578563
184352813 184557169
267846012 270194842
787080743 789209469
102034755 102793278
677264139 679983858
858429750 858446103
879077624 879224701
573990877 574468...

output:

2 3 4 5 6 7 8 9 11 18 21 23 28 29 30 31 33 37 38 40 41 42 43 44 45 49 50 51 56 59 60 61 62 65 66 67 68 70 71 72 73 74 76 77 78 79 82 85 86 89 90 91 96 97 99 101 102 103 106 107 109 112 113 114 116 118 120 121 122 123 124 125 126 129 134 138 139 140 141 142 143 144 146 148 149 150 152 153 155 157 164...

result:

ok answers are correct. (1 test case)

Test #4:

score: 5
Accepted
time: 1ms
memory: 3908kb

input:

1
1000
724221604 725069540
143194275 144876990
944969667 945425601
692430254 692500244
413915365 415513016
441154319 441817251
397426964 397797495
573976568 574310166
333482080 333658815
692670858 693494033
781215754 781315542
297042073 297766151
347972954 348085089
567271813 567539623
43283944 4381...

output:

2 5 6 7 9 12 13 15 18 22 23 24 26 27 29 32 33 34 35 36 38 39 40 41 42 44 53 54 55 56 61 62 64 67 68 72 73 75 77 79 83 84 85 86 87 89 93 96 97 98 100 105 106 107 110 111 113 115 116 121 123 124 125 126 128 129 130 133 138 141 143 147 149 152 158 160 161 166 168 170 171 173 174 176 178 179 180 181 182...

result:

ok answers are correct. (1 test case)

Test #5:

score: 5
Accepted
time: 2ms
memory: 4120kb

input:

1
10000
1915 1916
6871 6872
12925 12926
12679 12680
18809 18810
4725 4726
12781 12782
6363 6364
18471 18472
17037 17038
13225 13226
12201 12202
8365 8366
11427 11428
2859 2860
18423 18424
3519 3520
14647 14648
17649 17650
11249 11250
9003 9004
15623 15624
11345 11346
457 458
4805 4806
17905 17906
84...

output:

1 2 6 8 13 15 17 21 24 25 27 28 30 33 37 38 39 40 41 43 44 45 47 48 49 51 56 57 58 60 61 64 66 67 69 70 71 74 76 77 80 81 83 84 85 88 89 90 91 92 95 96 99 100 101 106 108 111 112 116 117 118 119 120 123 125 126 129 130 133 135 136 138 141 143 145 146 148 150 151 155 156 157 158 166 167 169 170 174 1...

result:

ok answers are correct. (1 test case)

Test #6:

score: 5
Accepted
time: 3ms
memory: 4408kb

input:

1
10000
951623572 951627967
944693469 944698949
866936571 866953676
708414261 708441197
918925455 918994693
693014496 693052258
500076831 500117857
346961903 346994890
790230509 790247658
486707346 486907093
703108219 703186545
666115252 666249778
638756819 638771288
605550898 605661894
618156528 61...

output:

8 10 18 19 20 21 24 25 27 28 29 30 32 33 35 40 42 46 47 48 53 56 58 61 62 63 68 74 75 76 78 79 80 81 82 85 89 91 95 96 97 98 99 100 102 103 104 106 107 109 110 111 113 114 116 117 118 119 120 121 123 124 130 132 135 138 140 141 143 145 147 149 154 157 159 160 162 163 164 167 168 169 173 175 176 178 ...

result:

ok answers are correct. (1 test case)

Test #7:

score: 5
Accepted
time: 21ms
memory: 6184kb

input:

1
100000
95477550 95482342
57260360 57270968
324158435 324161602
337960344 337966333
843677712 843688311
61482892 61483547
494172231 494182559
843751785 843754290
158705730 158714372
136974660 136976009
424424906 424425379
802041471 802042132
670649961 670659516
155724598 155724784
245837370 2458388...

output:

1 2 3 4 6 7 9 10 11 14 15 16 19 21 27 29 31 35 38 39 49 51 57 60 63 67 69 70 71 72 73 74 76 81 82 84 87 88 89 90 91 92 93 94 96 101 102 106 108 110 112 114 116 117 118 120 121 122 124 127 128 129 133 137 138 140 143 145 147 148 149 151 152 153 154 158 161 162 165 168 172 176 177 184 185 191 197 198 ...

result:

ok answers are correct. (1 test case)

Test #8:

score: 5
Accepted
time: 24ms
memory: 6152kb

input:

1
100000
126151 126152
147685 147686
168691 168692
124505 124506
58489 58490
98015 98016
173339 173340
39469 39470
135733 135734
53105 53106
118229 118230
46503 46504
36953 36954
185819 185820
27699 27700
64063 64064
60847 60848
18307 18308
1697 1698
109113 109114
99305 99306
72117 72118
107975 1079...

output:

5 6 8 10 12 13 15 16 17 18 19 21 22 29 32 33 34 36 37 38 39 41 42 43 44 45 46 47 48 49 50 51 52 53 59 62 64 65 67 73 74 75 77 86 89 90 95 96 102 103 104 105 107 109 111 112 114 116 117 118 120 121 123 125 129 131 132 141 143 146 147 148 150 151 152 153 156 162 163 164 165 166 167 169 170 171 174 177...

result:

ok answers are correct. (1 test case)

Subtask #2:

score: 0
Wrong Answer

Test #9:

score: 20
Accepted
time: 0ms
memory: 3868kb

input:

1
10
4 6
15 20
1 12
11 16
3 10
13 19
5 18
7 8
2 17
9 14

output:

1 3 5 7 8

result:

ok answers are correct. (1 test case)

Test #10:

score: 20
Accepted
time: 0ms
memory: 3824kb

input:

1
10
117956745 973823632
23571766 719701618
38785378 558526309
231187237 674007540
733362426 831144169
89816954 851213129
249341944 612792325
373425880 852493895
483542387 985564497
696597340 810358170

output:

1 2 3 4 6

result:

ok answers are correct. (1 test case)

Test #11:

score: 0
Wrong Answer
time: 0ms
memory: 3888kb

input:

1
14
16686983 932034450
223405271 642058261
317002236 708563919
199994594 587702670
454769448 522126055
746578284 809511289
133298121 894605432
94273255 452589074
5923134 643331337
350619519 385885046
317742836 915325929
320415015 743405145
48507375 963122902
124278107 221614208

output:

1 2 3 4 7 8 9

result:

wrong answer answer size for input: 4, answer size in participant solution: 1 (test case 1)

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #39:

score: 0
Wrong Answer
time: 0ms
memory: 4168kb

input:

1
10
8 9
15 18
12 13
5 14
7 10
1 20
2 19
6 11
3 4
16 17

output:

1 4 5 6 7

result:

wrong answer answer size for input: 4, answer size in participant solution: 1 (test case 1)

Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #2:

0%

Subtask #7:

score: 0
Skipped

Dependency #2:

0%

Subtask #8:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%