답안 #520984

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
520984 2022-01-31T15:19:28 Z lucri DEL13 (info1cup18_del13) C++17
0 / 100
9 ms 464 KB
#include <iostream>
using namespace std;
int t,n,f[210],b[210],a[210],q,ans[210];
bool ok[210];
int main()
{
    cin>>t;
    while(t--)
    {
        ans[0]=0;
        cin>>n>>q;
        for(int i=1;i<=q;++i)
            cin>>f[i];
        int j=1;
        for(int i=1;i<=n;++i)
        {
            if(f[j]==i)
            {
                ++j;
                ok[i]=true;
            }
            else
                ok[i]=false;
            b[i]=i-1;
            a[i]=i+1;
        }
        a[0]=1;
        bool x=true;
        while(x)
        {
            x=false;
            for(int i=1;i<=n;++i)
            {
                if(ok[b[i]]==false&&ok[a[i]]==false&&b[i]!=0&&a[i]!=n+1)
                {
                    x=true;
                    ans[++ans[0]]=i;
                    a[b[b[i]]]=i;
                    b[a[a[i]]]=i;
                    a[i]=a[a[i]];
                    b[i]=b[b[i]];
                }
            }
        }
        for(int i=a[0];i<=n;i=a[i])
        {
            if(ok[i]==false)
            {
                ans[0]=-1;
                break;
            }
        }
        cout<<ans[0]<<'\n';
        for(int i=1;i<=ans[0];++i)
            cout<<ans[i]<<' ';
        if(ans[0]>0)
            cout<<'\n';
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 208 KB Output isn't correct
2 Incorrect 2 ms 304 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 208 KB Output isn't correct
2 Incorrect 2 ms 304 KB Output isn't correct
3 Incorrect 9 ms 336 KB Output isn't correct
4 Incorrect 8 ms 336 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 11
2 Runtime error 1 ms 464 KB Execution killed with signal 11
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 208 KB Output isn't correct
2 Incorrect 2 ms 304 KB Output isn't correct
3 Incorrect 9 ms 336 KB Output isn't correct
4 Incorrect 8 ms 336 KB Output isn't correct
5 Incorrect 1 ms 208 KB Output isn't correct
6 Incorrect 1 ms 208 KB Output isn't correct
7 Incorrect 1 ms 208 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 208 KB Output isn't correct
2 Incorrect 2 ms 304 KB Output isn't correct
3 Incorrect 9 ms 336 KB Output isn't correct
4 Incorrect 8 ms 336 KB Output isn't correct
5 Incorrect 1 ms 208 KB Output isn't correct
6 Incorrect 1 ms 208 KB Output isn't correct
7 Incorrect 1 ms 208 KB Output isn't correct
8 Runtime error 1 ms 444 KB Execution killed with signal 11
9 Runtime error 1 ms 436 KB Execution killed with signal 11
10 Runtime error 1 ms 420 KB Execution killed with signal 11
11 Runtime error 2 ms 464 KB Execution killed with signal 11