QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#407392#8267. Staring ContestPhysics2123030 4ms3788kbC++17715b2024-05-08 17:15:272024-05-08 17:15:28

Judging History

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

  • [2024-05-08 17:15:28]
  • 评测
  • 测评结果:0
  • 用时:4ms
  • 内存:3788kb
  • [2024-05-08 17:15:27]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(false);
  int n; cin>>n;
  vector<int> a(n),p(n);
  iota(p.begin(),p.end(),0);
  shuffle(p.begin(),p.end(),mt19937(random_device()()));
  auto ask=[&](int x,int y){
    cout<<"? "<<x+1<<' '<<y+1<<endl;
    int r; cin>>r; return r;
  };
  int x=-1,y=-1,w=-1;
  for(int i:p){
    if(x<0)x=i;
    else if(y<0)y=i,w=ask(x,y);
    else{
      int o=ask(x,i),t;
      if(w<o)a[y]=w,y=i,w=o;
      else if(w>o)a[i]=o;
      else if((t=ask(y,i))==w)a[i]=a[x]=a[y]=w,x=y=-1;
      else a[x]=w,x=y,y=i,w=t;
    }
  }
  if(~x)a[x]; if(~y)a[y]=w;
  cout<<"! ";
  for(int i:a)cout<<i+1<<' ';
  cout<<endl;
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 9
Accepted
time: 1ms
memory: 3788kb

input:

2
1

output:

? 1 2
! 1 2 

result:

points 1.0 points  1.0 n = 2, you used 1 queries

Test #2:

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

input:

2
1

output:

? 1 2
! 1 2 

result:

wrong answer wrong answer b[2] <= a[2] not held.

Subtask #2:

score: 0
Wrong Answer

Test #58:

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

input:

1000
183
183
237
215
237
617
702
751
383
593
7
738
825
620
889
477
116
70
169
389
385
217
241
539
616
701
889
928
578
928
973
72
973
981
129
926
138
354
112
81
422
640
52
781
842
205
950
684
650
238
712
109
379
291
172
736
796
857
648
293
686
88
510
981
985
401
247
292
583
802
210
10
125
80
464
94
8...

output:

? 183 237
? 183 889
? 237 889
? 237 215
? 237 617
? 889 617
? 889 702
? 889 751
? 889 383
? 889 593
? 889 7
? 889 738
? 889 825
? 889 620
? 889 928
? 889 477
? 889 116
? 889 70
? 889 169
? 889 389
? 889 385
? 889 217
? 889 241
? 889 539
? 889 616
? 889 701
? 889 973
? 928 973
? 928 578
? 928 981
? 9...

result:

wrong answer wrong answer b[1] <= a[1] not held.

Subtask #3:

score: 0
Wrong Answer

Test #88:

score: 0
Wrong Answer
time: 4ms
memory: 3604kb

input:

1500
386
145
386
778
1036
896
472
939
709
649
437
1036
1244
584
746
62
872
92
805
1122
66
45
1225
200
175
1279
201
605
403
991
1279
1394
22
294
1339
228
1080
404
1100
220
1128
48
204
1394
1398
1313
1349
1004
659
965
1371
407
625
801
851
58
824
769
926
137
1227
933
1059
1376
1181
73
526
1005
1258
107...

output:

? 386 1036
? 386 145
? 386 778
? 1036 778
? 1036 1279
? 1036 896
? 1036 472
? 1036 939
? 1036 709
? 1036 649
? 1036 437
? 1036 1244
? 1279 1244
? 1279 584
? 1279 746
? 1279 62
? 1279 872
? 1279 92
? 1279 805
? 1279 1122
? 1279 66
? 1279 45
? 1279 1225
? 1279 200
? 1279 175
? 1279 1394
? 1279 201
? 1...

result:

wrong answer wrong answer b[1] <= a[1] not held.