QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#831137 | #8907. Конференция | XY_Eleven | 0 | 0ms | 4124kb | C++20 | 4.6kb | 2024-12-25 11:08:41 | 2024-12-25 11:08:42 |
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()
{
}
void main_solve()
{
int n; inint(n);
vct <array<int,3> > a(n);
For_(i,0,n) inpr(a[i][0],a[i][1]),a[i][2]=i+1;
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],z2=b[(m>>1)][0];
// printf("%d %d\n",z1,z2);
vct <array<int,3> > ans1,ans2;
for(auto [l,r,id]:b)
{
if(l<=z1) ans1.pb({l,r,id});
if(r>=z2) ans2.pb({l,r,id});
}
for(auto [l,r,id]:b2)
{
if(l<=z1) ans1.pb({l,r,id});
if(r>=z2) ans2.pb({l,r,id});
}
if(sz(ans1)<(n>>1)) ans1.swap(ans2);
if(sz(ans1)<(n>>1))
{
puts("Boom");
exit(1);
}
vct <int> t; ans1.resize(n>>1); For_(i,0,n>>1) t.pb(ans1[i][2]);
sort(all(t));
For_(i,0,n>>1) outint2_(t[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;
}
/*
*/
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3872kb
input:
1 4 823983109 859315505 510901709 589624124 351308325 413158126 29447781 138101981
output:
4 3 4
result:
wrong output format Extra information in the output file (test case 1)
Subtask #2:
score: 0
Wrong Answer
Test #9:
score: 0
Wrong Answer
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:
4 1 3 5 8 9
result:
wrong answer answer size for input: 4, answer size in participant solution: 3 (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: 4124kb
input:
1 10 8 9 15 18 12 13 5 14 7 10 1 20 2 19 6 11 3 4 16 17
output:
4 1 4 5 8 9
result:
wrong answer Index 4 encountered twice (test case 1)
Subtask #5:
score: 0
Skipped
Dependency #1:
0%
Subtask #6:
score: 0
Skipped
Dependency #2:
0%
Subtask #7:
score: 0
Skipped
Dependency #2:
0%
Subtask #8:
score: 0
Skipped
Dependency #1:
0%