Submission #1098372

# Submission time Handle Problem Language Result Execution time Memory
1098372 2024-10-09T10:47:53 Z alexander707070 Sorting (IOI15_sorting) C++14
0 / 100
1000 ms 508 KB
#include<bits/stdc++.h>
#include "sorting.h"

#define MAXN 200007
using namespace std;

int n,m;
int pos[MAXN],s[MAXN];

int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
    n=N; m=M;

	for(int i=0;i<n;i++)s[i]=S[i];

	for(int i=0;i<n;i++){
		if(X[0]==0 and Y[0]==1)swap(s[0],s[1]);

		for(int f=0;f<n;f++){
			if(s[f]==i){

				P[i]=i; Q[i]=f;
				swap(s[i],s[f]);
			}
		}
	}

	while(n>0 and P[n-1]==Q[n-1]){
		if(X[0]==0 and Y[0]==1)swap(s[0],s[1]);
	}

	if(s[0]>s[1]){
		n++;
		P[n-1]=Q[n-1]=0;
	}


	return n;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1043 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 508 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 508 KB Time limit exceeded
2 Halted 0 ms 0 KB -