QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#439826#1813. Joy with PermutationsKalenistWA 0ms3684kbC++201.1kb2024-06-12 19:10:082024-06-12 19:10:09

Judging History

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

  • [2024-06-12 19:10:09]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3684kb
  • [2024-06-12 19:10:08]
  • 提交

answer

#include<bits/stdc++.h>
#define N 60010
#define For(i,a,b) for(register int i=a;i<=b;i++)
using namespace std;
int n,a[5],val[N],ans[N];
int cnta[N],cntd[N];
inline bool rule(int a,int b){return val[a]<val[b];}
inline int ask1(int a,int b,int c)
{
    cout<<"? 1 "<<a<<" "<<b<<" "<<c<<endl,cout.flush();
    int x;scanf("%d",&x);
    return x;
}

inline int ask2(int a,int b)
{
    cout<<"? 2 "<<a<<" "<<b<<endl,cout.flush();
    int x;scanf("%d",&x);
    return x;
}

int main()
{
    scanf("%d",&n);
    For(i,1,4) a[i]=i;
    val[1]=ask1(2,3,4),val[2]=ask1(1,3,4);
    val[3]=ask1(1,2,4),val[4]=ask1(1,2,3);
    sort(a+1,a+5,rule);
    if(ask2(a[1],a[2]) != a[1]) swap(a[1],a[2]);
    if(ask2(a[3],a[4]) != a[3]) swap(a[3],a[4]);
    ans[a[2]]=val[2],ans[a[3]]=val[3];
    For(i,5,n)
    {
        val[i]=ask1(a[2],a[3],i);
        if(val[i] == val[2])
            cnta[val[i]=ask1(a[1],a[2],i)]++;
        else if(val[2] == val[3])
            cntd[val[i]=ask1(a[3],a[4],i)]++;
        else ans[i]=val[i];
    }cout<<"! ";
    For(i,1,n) cout<<i<<" ";
    cout.flush();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
4
3
3
4
3
4
2
2

output:

? 1 2 3 4
? 1 1 3 4
? 1 1 2 4
? 1 1 2 3
? 2 2 3
? 2 1 4
? 1 2 4 5
? 1 4 1 5
! 1 2 3 4 5 

result:

wrong answer Guess is wrong