QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#559423#8835. Goodmansnow#WA 0ms3548kbC++23881b2024-09-11 21:59:362024-09-11 21:59:37

Judging History

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

  • [2024-09-11 21:59:37]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3548kb
  • [2024-09-11 21:59:36]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(void)
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t;
    cin >> t;
    while (t--)
    {
        ll n;
        cin >> n;
        ll a[n + 1] = {0},b[n+1]={0},c[n+1]={0};
        map<ll, ll> mp;
        map<ll, ll> p;
        for (ll i = 1; i <= n; i++)
        {
            cin >> a[i];
            b[a[i]]=i;
        }
        for(ll i=1;i<=n;i++)
        {
            if(a[i]==i)
                cout<<i;
        }
        for(ll i=1;i<=n;i++)
        {
            if(a[i]!=i&&c[i]==0)
            {
                cout<<i;
                c[i]=1;
                if(c[b[i]]==0)
                {
                    cout<<b[i];
                    c[b[i]]=1;
                }
            }
        }
        cout<<'\n';
    }
}

詳細信息

Test #1:

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

input:

2
4
1 2 3 4
6
6 5 4 3 2 1

output:

1234
162534

result:

wrong answer Integer parameter [name=q] equals to 1234, violates the range [1, 4] (test case 1)