답안 #169601

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
169601 2019-12-21T11:16:13 Z Rouge_Hugo Permutation Recovery (info1cup17_permutation) C++14
10 / 100
61 ms 504 KB
#include <bits/stdc++.h>
#define ll long long
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;
int n;int a[100];
int vis[100];
vector<int>v,vv;
void d (int ind)
{
    if (ind==n+1)
    {
        for(auto it:v)vv.push_back(it);
        return ;

    }
    ll re=0;
    for(int i=1;i<n+1;i++)
    {
        re=0;
        if (vis[i])continue;
        for(int j=0;j<ind-1;j++)
        {
            if (v[j]<i)re+=a[j+1];
        }
        if (re==a[ind]-1)
        {
            vis[i]=1;
            v.push_back(i);
            d(ind+1);
            vis[i]=0;
            v.pop_back();
        }
    }
}
int main()
{fast;
    cin>>n;
    for(int i=1;i<n+1;i++)cin>>a[i];
    for(int i=n;i>0;i--)a[i]-=a[i-1];
    d(1);
    for(auto it:vv)cout<<it<<" ";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Runtime error 61 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Runtime error 61 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Runtime error 61 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Runtime error 61 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Runtime error 61 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Runtime error 61 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Runtime error 61 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)