답안 #782147

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
782147 2023-07-13T15:40:12 Z amirhoseinfar1385 Watermelon (INOI20_watermelon) C++17
0 / 100
8 ms 1100 KB
#include<bits/stdc++.h>
using namespace std;
int n,m;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>m;
	vector<int>all(n);
	for(int i=0;i<n;i++){
		cin>>all[i];
	}
	vector<int>res(n+1);
	vector<int>allv;
	for(int i=0;i<n;i++){
		if(all[i]==-1){
			allv.push_back(i);
		}
	}
	int now=n;
	for(int i=0;i<(int)allv.size();i++){
		res[allv[i]]=now;
		now--;
	}
	now=1;
	int last=-1;
	for(int j=0;j<n;j++){
		if(all[j]==1){
			for(int h=j;h>last;h--){
				res[h]=now;
				now++;
			}
			last=j;
		}	
		if(all[j]==-1){
			last=j;
		}
	}
	for(int i=0;i<n;i++){
		cout<<res[i]<<" ";
	}
	cout<<"\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 320 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 320 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1100 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1100 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 320 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -