답안 #415212

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
415212 2021-05-31T17:02:48 Z GK2007 Group Photo (JOI21_ho_t3) C++14
0 / 100
2 ms 204 KB
#include<iostream>
using namespace std;
int main(){
	int n,i,c=0,d=0,e=0;
	cin>>n;
	int a[n+1];
	for(i=1; i<=n; i++)
	{
		cin>>a[i];
	}
	while(c==0)
	{
		d=0;
		for(i=1; i<n; i++)
		{
			if(a[i]>=a[i+1]+2)
			{
				swap(a[i], a[i+1]);
				d=1;
				e++;
			}
		}
		if(d==0)
		{
			c=1;
		}
	}
	cout<<e;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -