QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#416469#8267. Staring ContestLynkcat0 1ms5816kbC++201005b2024-05-21 21:09:042024-05-21 21:09:04

Judging History

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

  • [2024-05-21 21:09:04]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:5816kb
  • [2024-05-21 21:09:04]
  • 提交

answer

#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) (int)((x).size())
//#define int ll
//#define N
using namespace std;
int n,p[1000005],a[1000005];
mt19937 rnd(time(0));
int query(int x,int y)
{
	cout<<"? "<<x<<" "<<y<<endl;
	int res;
	cin>>res;
	return res;
}
void BellaKira()
{
	cin>>n;
	for (int i=1;i<=n;i++) p[i]=i;
	shuffle(p+1,p+n+1,rnd);
	int x=p[1],y=p[2],z=query(x,y);
	for (int i=3;i<=n;i++)
	{
		int o=query(x,p[i]);
		if (o<z)
		{
			a[p[i]]=o;
			continue;
		}
		if (o>z)
		{
			a[y]=z;
			continue;
		}
		a[x]=z;
		x=y;
		y=p[i];
		z=query(x,y);
	}
	a[x]=a[y]=z;
	cout<<"! ";
	for (int i=1;i<=n;i++)  cout<<a[i]<<" ";cout<<endl;
}
signed main()
{
	IOS;
	cin.tie(0);
	int T=1;
	while (T--)
	{
		BellaKira();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 9
Accepted
time: 0ms
memory: 5632kb

input:

2
1

output:

? 1 2
! 1 1 

result:

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

Test #2:

score: 9
Accepted
time: 0ms
memory: 5644kb

input:

2
1

output:

? 1 2
! 1 1 

result:

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

Test #3:

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

input:

2
1

output:

? 1 2
! 1 1 

result:

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

Test #4:

score: 0
Wrong Answer
time: 1ms
memory: 5816kb

input:

50
15
10
15
34
31
1
13
34
43
45
16
28
39
8
32
21
30
22
45
37
11
3
27
4
45
5
19
24
17
35
20
33
18
14
23
12
45
2
40
41
36
7
44
38
6
29
9
42
26
25
45

output:

? 15 34
? 15 10
? 15 45
? 34 45
? 34 31
? 34 1
? 34 13
? 34 43
? 45 43
? 45 47
? 45 16
? 45 28
? 45 39
? 45 8
? 45 32
? 45 21
? 45 30
? 45 22
? 45 48
? 45 37
? 45 11
? 45 3
? 45 27
? 45 4
? 45 46
? 45 5
? 45 19
? 45 24
? 45 17
? 45 35
? 45 20
? 45 33
? 45 18
? 45 14
? 45 23
? 45 12
? 45 49
? 45 2
? ...

result:

wrong answer mismatched on more than one position

Subtask #2:

score: 0
Wrong Answer

Test #58:

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

input:

1000
267
267
437
437
553
568
431
679
588
243
433
183
369
679
298
679
373
120
679
479
679
336
400
56
646
452
476
679
679
513
679
583
607
679
653
382
128
252
328
361
679
171
679
679
291
245
679
390
460
679
448
679
403
679
501
679
316
321
668
319
418
488
626
289
154
32
679
679
24
679
232
679
599
92
679...

output:

? 267 437
? 267 679
? 437 679
? 437 553
? 679 553
? 679 568
? 679 431
? 679 929
? 679 588
? 679 243
? 679 433
? 679 183
? 679 369
? 679 893
? 679 298
? 679 693
? 679 373
? 679 120
? 679 704
? 679 479
? 679 885
? 679 336
? 679 400
? 679 56
? 679 646
? 679 452
? 679 476
? 679 773
? 679 826
? 679 513
?...

result:

wrong answer mismatched on more than one position

Subtask #3:

score: 0
Wrong Answer

Test #88:

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

input:

1500
267
267
679
1140
568
1124
929
588
1140
1140
183
369
893
1140
1140
373
120
1140
479
885
336
1140
56
1140
1140
476
1021
1140
513
1075
583
1140
829
1140
382
1140
1140
328
1140
748
171
1140
813
291
1132
1140
390
460
978
448
1140
403
824
501
1140
316
321
668
319
418
488
626
289
154
1140
811
787
1066...

output:

? 267 1140
? 267 679
? 1140 679
? 1140 1440
? 1140 568
? 1140 1124
? 1140 929
? 1140 588
? 1140 1287
? 1140 1391
? 1140 183
? 1140 369
? 1140 893
? 1140 1226
? 1140 1430
? 1140 373
? 1140 120
? 1140 1187
? 1140 479
? 1140 885
? 1140 336
? 1140 1210
? 1140 56
? 1140 1315
? 1140 1246
? 1140 476
? 1140...

result:

wrong answer mismatched on more than one position