Submission #415212

# Submission time Handle Problem Language Result Execution time Memory
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;
}
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -