답안 #284838

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
284838 2020-08-28T06:41:33 Z Ronin13 Labels (NOI20_labels) C++14
7 / 100
27 ms 1280 KB
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ull unsigned ll
#define pb push_back
#define mp make_pair
 
using namespace std;
int d[100001];
int n;
int a[100001];
int cnt=0;
vector<vector<int> >ans;
void rec(int ind,int val,vector<int>k){
	if(ind==n){
		k.pb(val);
		ans.pb(k);
		cnt++;
		return;
	}
	k.pb(val);
	for(int i=1;i<=n;i++){
		if(i-val==d[ind])rec(ind+1,i,k);
	}
}

int main(){
	cin>>n;
	
	for(int i=1;i<n;i++)cin>>d[i];
	if(n==2){
		for(int i=1;i<=n;i++){
			vector<int>k;
			rec(1,i,k);
		
		}
		if(cnt>1||cnt==0)cout<<-1;
		else{
			for(int i=0;i<ans[0].size();i++)cout<<ans[0][i]<<' ';
		}
	}
	return 0;
}

Compilation message

Labels.cpp: In function 'int main()':
Labels.cpp:42:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |    for(int i=0;i<ans[0].size();i++)cout<<ans[0][i]<<' ';
      |                ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Incorrect 0 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Incorrect 0 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 27 ms 1280 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Incorrect 0 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -