답안 #1080971

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1080971 2024-08-29T16:32:15 Z Trumling 정렬하기 (IOI15_sorting) C++14
0 / 100
1 ms 600 KB
#include "sorting.h"
#include<bits/stdc++.h>
using namespace std;
     
#define F first
#define pb push_back
#define all(x) x.begin(),x.end()
#define INF 9999999999999999
typedef long long ll;
ll n;
 
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) 
{ 
	n=N;
    ll pos[N];
    for(int i=0;i<N;i++)
		pos[S[i]]=i;
 
 
	
	for(int i=0;i<N;i++)
	{
		P[i]=pos[i];
		Q[i]=i;
		swap(S[pos[i]],S[i]);
		pos[S[pos[i]]]=pos[i];
		pos[i]=i;
 
	}
 
	return N;
		
}

Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:23:13: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   23 |   P[i]=pos[i];
      |        ~~~~~^
sorting.cpp:12:40: warning: unused parameter 'M' [-Wunused-parameter]
   12 |  int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[])
      |                                    ~~~~^
sorting.cpp:12:47: warning: unused parameter 'X' [-Wunused-parameter]
   12 |  int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[])
      |                                           ~~~~^~~
sorting.cpp:12:56: warning: unused parameter 'Y' [-Wunused-parameter]
   12 |  int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[])
      |                                                    ~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -