QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#589237 | #7535. Limited Shuffle Restoring | Kevin5307 | WA | 1ms | 3868kb | C++20 | 1.2kb | 2024-09-25 16:49:34 | 2024-09-25 16:49:37 |
Judging History
answer
//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
int a[50050];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
vector<int> vec;
int n;
cin>>n;
for(int i=n;i>=1;i--)
{
vector<int> v2;
while(sz(vec)&&sz(v2)<2)
{
cout<<"? "<<i<<" "<<vec.back()<<endl;
char ch;
cin>>ch;
if(ch=='<') break;
v2.pb(vec.back());
vec.pop_back();
}
vec.pb(i);
rev(v2);
for(auto x:v2)
vec.pb(x);
}
rev(vec);
for(int i=1;i<=n;i++)
a[vec[i-1]]=i;
cout<<"! ";
for(int i=1;i<=n;i++)
cout<<a[i]<<" ";
cout<<endl;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3624kb
input:
5 > < > < > <
output:
? 4 5 ? 3 5 ? 2 3 ? 2 5 ? 1 3 ? 1 2 ! 2 3 1 5 4
result:
ok yeah, seems ok, spent 6 queries of 13
Test #2:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
1
output:
! 1
result:
ok yeah, seems ok, spent 0 queries of 6
Test #3:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
2 >
output:
? 1 2 ! 2 1
result:
ok yeah, seems ok, spent 1 queries of 8
Test #4:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
3 > > >
output:
? 2 3 ? 1 3 ? 1 2 ! 3 2 1
result:
ok yeah, seems ok, spent 3 queries of 10
Test #5:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
4 > > > > >
output:
? 3 4 ? 2 4 ? 2 3 ? 1 4 ? 1 3 ! 3 4 2 1
result:
ok yeah, seems ok, spent 5 queries of 11
Test #6:
score: 0
Accepted
time: 1ms
memory: 3540kb
input:
5 > > > > > > >
output:
? 4 5 ? 3 5 ? 3 4 ? 2 5 ? 2 4 ? 1 5 ? 1 4 ! 3 4 5 2 1
result:
ok yeah, seems ok, spent 7 queries of 13
Test #7:
score: 0
Accepted
time: 1ms
memory: 3784kb
input:
6 > > > > > > > > >
output:
? 5 6 ? 4 6 ? 4 5 ? 3 6 ? 3 5 ? 2 6 ? 2 5 ? 1 6 ? 1 5 ! 3 4 5 6 2 1
result:
ok yeah, seems ok, spent 9 queries of 15
Test #8:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
7 > > > > > > > > > > >
output:
? 6 7 ? 5 7 ? 5 6 ? 4 7 ? 4 6 ? 3 7 ? 3 6 ? 2 7 ? 2 6 ? 1 7 ? 1 6 ! 3 4 5 6 7 2 1
result:
ok yeah, seems ok, spent 11 queries of 16
Test #9:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
8 > > > > > > > > > > > > >
output:
? 7 8 ? 6 8 ? 6 7 ? 5 8 ? 5 7 ? 4 8 ? 4 7 ? 3 8 ? 3 7 ? 2 8 ? 2 7 ? 1 8 ? 1 7 ! 3 4 5 6 7 8 2 1
result:
ok yeah, seems ok, spent 13 queries of 18
Test #10:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
9 > > > > > > > > > > > > > > >
output:
? 8 9 ? 7 9 ? 7 8 ? 6 9 ? 6 8 ? 5 9 ? 5 8 ? 4 9 ? 4 8 ? 3 9 ? 3 8 ? 2 9 ? 2 8 ? 1 9 ? 1 8 ! 3 4 5 6 7 8 9 2 1
result:
ok yeah, seems ok, spent 15 queries of 20
Test #11:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
10 > > > > > > > > > > > > > > > > >
output:
? 9 10 ? 8 10 ? 8 9 ? 7 10 ? 7 9 ? 6 10 ? 6 9 ? 5 10 ? 5 9 ? 4 10 ? 4 9 ? 3 10 ? 3 9 ? 2 10 ? 2 9 ? 1 10 ? 1 9 ! 3 4 5 6 7 8 9 10 2 1
result:
ok yeah, seems ok, spent 17 queries of 21
Test #12:
score: 0
Accepted
time: 1ms
memory: 3852kb
input:
11 > > > > > > > > > > > > > > > > > > >
output:
? 10 11 ? 9 11 ? 9 10 ? 8 11 ? 8 10 ? 7 11 ? 7 10 ? 6 11 ? 6 10 ? 5 11 ? 5 10 ? 4 11 ? 4 10 ? 3 11 ? 3 10 ? 2 11 ? 2 10 ? 1 11 ? 1 10 ! 3 4 5 6 7 8 9 10 11 2 1
result:
ok yeah, seems ok, spent 19 queries of 23
Test #13:
score: 0
Accepted
time: 1ms
memory: 3456kb
input:
12 > > > > > > > > > > > > > > > > > > > > >
output:
? 11 12 ? 10 12 ? 10 11 ? 9 12 ? 9 11 ? 8 12 ? 8 11 ? 7 12 ? 7 11 ? 6 12 ? 6 11 ? 5 12 ? 5 11 ? 4 12 ? 4 11 ? 3 12 ? 3 11 ? 2 12 ? 2 11 ? 1 12 ? 1 11 ! 3 4 5 6 7 8 9 10 11 12 2 1
result:
ok yeah, seems ok, spent 21 queries of 25
Test #14:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
13 > > > > > > > > > > > > > > > > > > > > > > >
output:
? 12 13 ? 11 13 ? 11 12 ? 10 13 ? 10 12 ? 9 13 ? 9 12 ? 8 13 ? 8 12 ? 7 13 ? 7 12 ? 6 13 ? 6 12 ? 5 13 ? 5 12 ? 4 13 ? 4 12 ? 3 13 ? 3 12 ? 2 13 ? 2 12 ? 1 13 ? 1 12 ! 3 4 5 6 7 8 9 10 11 12 13 2 1
result:
ok yeah, seems ok, spent 23 queries of 26
Test #15:
score: 0
Accepted
time: 1ms
memory: 3600kb
input:
14 > > > > > > > > > > > > > > > > > > > > > > > > >
output:
? 13 14 ? 12 14 ? 12 13 ? 11 14 ? 11 13 ? 10 14 ? 10 13 ? 9 14 ? 9 13 ? 8 14 ? 8 13 ? 7 14 ? 7 13 ? 6 14 ? 6 13 ? 5 14 ? 5 13 ? 4 14 ? 4 13 ? 3 14 ? 3 13 ? 2 14 ? 2 13 ? 1 14 ? 1 13 ! 3 4 5 6 7 8 9 10 11 12 13 14 2 1
result:
ok yeah, seems ok, spent 25 queries of 28
Test #16:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
15 > > > > > > > > > > > > > > > > > > > > > > > > > > >
output:
? 14 15 ? 13 15 ? 13 14 ? 12 15 ? 12 14 ? 11 15 ? 11 14 ? 10 15 ? 10 14 ? 9 15 ? 9 14 ? 8 15 ? 8 14 ? 7 15 ? 7 14 ? 6 15 ? 6 14 ? 5 15 ? 5 14 ? 4 15 ? 4 14 ? 3 15 ? 3 14 ? 2 15 ? 2 14 ? 1 15 ? 1 14 ! 3 4 5 6 7 8 9 10 11 12 13 14 15 2 1
result:
ok yeah, seems ok, spent 27 queries of 30
Test #17:
score: 0
Accepted
time: 1ms
memory: 3868kb
input:
16 > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
output:
? 15 16 ? 14 16 ? 14 15 ? 13 16 ? 13 15 ? 12 16 ? 12 15 ? 11 16 ? 11 15 ? 10 16 ? 10 15 ? 9 16 ? 9 15 ? 8 16 ? 8 15 ? 7 16 ? 7 15 ? 6 16 ? 6 15 ? 5 16 ? 5 15 ? 4 16 ? 4 15 ? 3 16 ? 3 15 ? 2 16 ? 2 15 ? 1 16 ? 1 15 ! 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 1
result:
ok yeah, seems ok, spent 29 queries of 31
Test #18:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
17 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
output:
? 16 17 ? 15 17 ? 15 16 ? 14 17 ? 14 16 ? 13 17 ? 13 16 ? 12 17 ? 12 16 ? 11 17 ? 11 16 ? 10 17 ? 10 16 ? 9 17 ? 9 16 ? 8 17 ? 8 16 ? 7 17 ? 7 16 ? 6 17 ? 6 16 ? 5 17 ? 5 16 ? 4 17 ? 4 16 ? 3 17 ? 3 16 ? 2 17 ? 2 16 ? 1 17 ? 1 16 ! 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 1
result:
ok yeah, seems ok, spent 31 queries of 33
Test #19:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
18 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
output:
? 17 18 ? 16 18 ? 16 17 ? 15 18 ? 15 17 ? 14 18 ? 14 17 ? 13 18 ? 13 17 ? 12 18 ? 12 17 ? 11 18 ? 11 17 ? 10 18 ? 10 17 ? 9 18 ? 9 17 ? 8 18 ? 8 17 ? 7 18 ? 7 17 ? 6 18 ? 6 17 ? 5 18 ? 5 17 ? 4 18 ? 4 17 ? 3 18 ? 3 17 ? 2 18 ? 2 17 ? 1 18 ? 1 17 ! 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 1
result:
ok yeah, seems ok, spent 33 queries of 35
Test #20:
score: 0
Accepted
time: 1ms
memory: 3860kb
input:
19 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
output:
? 18 19 ? 17 19 ? 17 18 ? 16 19 ? 16 18 ? 15 19 ? 15 18 ? 14 19 ? 14 18 ? 13 19 ? 13 18 ? 12 19 ? 12 18 ? 11 19 ? 11 18 ? 10 19 ? 10 18 ? 9 19 ? 9 18 ? 8 19 ? 8 18 ? 7 19 ? 7 18 ? 6 19 ? 6 18 ? 5 19 ? 5 18 ? 4 19 ? 4 18 ? 3 19 ? 3 18 ? 2 19 ? 2 18 ? 1 19 ? 1 18 ! 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1...
result:
ok yeah, seems ok, spent 35 queries of 36
Test #21:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
20 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
output:
? 19 20 ? 18 20 ? 18 19 ? 17 20 ? 17 19 ? 16 20 ? 16 19 ? 15 20 ? 15 19 ? 14 20 ? 14 19 ? 13 20 ? 13 19 ? 12 20 ? 12 19 ? 11 20 ? 11 19 ? 10 20 ? 10 19 ? 9 20 ? 9 19 ? 8 20 ? 8 19 ? 7 20 ? 7 19 ? 6 20 ? 6 19 ? 5 20 ? 5 19 ? 4 20 ? 4 19 ? 3 20 ? 3 19 ? 2 20 ? 2 19 ? 1 20 ? 1 19 ! 3 4 5 6 7 8 9 10 11 ...
result:
ok yeah, seems ok, spent 37 queries of 38
Test #22:
score: -100
Wrong Answer
time: 0ms
memory: 3628kb
input:
111 < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < > < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < > < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ...
output:
? 110 111 ? 109 110 ? 109 111 ? 108 110 ? 108 111 ? 107 110 ? 107 111 ? 106 110 ? 106 111 ? 105 110 ? 105 111 ? 104 110 ? 104 111 ? 103 110 ? 103 111 ? 102 110 ? 102 111 ? 101 110 ? 101 111 ? 100 110 ? 100 111 ? 99 110 ? 99 111 ? 98 110 ? 98 111 ? 97 110 ? 97 111 ? 96 110 ? 96 111 ? 95 110 ? 95 111 ...
result:
wrong answer didn't fit into 190 queries