답안 #97628

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
97628 2019-02-17T14:35:39 Z KLPP Permutation Recovery (info1cup17_permutation) C++14
25 / 100
5 ms 2304 KB
#include<bits/stdc++.h>

using namespace std;
typedef long long int lld;

int main(){
	int n;
	cin>>n;
	lld Q[n];
	for(int i=0;i<n;i++)cin>>Q[i];
	lld diff[n];
	diff[0]=Q[0];
	for(int i=1;i<n;i++)diff[i]=Q[i]-Q[i-1];
	int table[n][n];
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++)table[i][j]=0;
	}
	for(int i=1;i<n;i++){
		lld x=diff[i];
		x--;
		for(int j=i-1;j>-1;j--){
			if(diff[j]<=x){
				x-=diff[j];
				table[j][i]=1;
			}else table[i][j]=1;
		}
	}
	int per[n];
	for(int i=0;i<n;i++)per[i]=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++)per[i]+=table[j][i];
	}
	for(int i=0;i<n;i++)cout<<per[i]<<" ";
	cout<<endl;	
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 4 ms 1024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 4 ms 1024 KB Output is correct
3 Incorrect 5 ms 2304 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 4 ms 1024 KB Output is correct
3 Incorrect 5 ms 2304 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 4 ms 1024 KB Output is correct
3 Incorrect 5 ms 2304 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 4 ms 1024 KB Output is correct
3 Incorrect 5 ms 2304 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 4 ms 1024 KB Output is correct
3 Incorrect 5 ms 2304 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 4 ms 1024 KB Output is correct
3 Incorrect 5 ms 2304 KB Output isn't correct
4 Halted 0 ms 0 KB -