Submission #126173

# Submission time Handle Problem Language Result Execution time Memory
126173 2019-07-07T07:51:31 Z SOIVIEONE Sorting (IOI15_sorting) C++14
0 / 100
3 ms 632 KB
#include "sorting.h"
#include <bits/stdc++.h>
using namespace std;
int id[2222222];
int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
	for(int i = 0; i < N; i ++)
		id[S[i]] = i;
	memset(P, 0, sizeof P);
	memset(Q, 0, sizeof Q);
	for(int i = 0; i < N; i ++)
	{
		swap(S[id[i]], S[i]);
		P[i] = id[i]; Q[i] = i;
		id[S[id[i]]] = id[i];
		id[i] = i;
	}
	return M;
}


Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:8:22: warning: 'sizeof' on array function parameter 'P' will return size of 'int*' [-Wsizeof-array-argument]
  memset(P, 0, sizeof P);
                      ^
sorting.cpp:5:66: note: declared here
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
                                                                  ^
sorting.cpp:8:22: warning: argument to 'sizeof' in 'void* memset(void*, int, size_t)' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
  memset(P, 0, sizeof P);
                      ^
sorting.cpp:9:22: warning: 'sizeof' on array function parameter 'Q' will return size of 'int*' [-Wsizeof-array-argument]
  memset(Q, 0, sizeof Q);
                      ^
sorting.cpp:5:75: note: declared here
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
                                                                           ^
sorting.cpp:9:22: warning: argument to 'sizeof' in 'void* memset(void*, int, size_t)' call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess]
  memset(Q, 0, sizeof Q);
                      ^
sorting.cpp:5:48: warning: unused parameter 'X' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
                                                ^
sorting.cpp:5:57: warning: unused parameter 'Y' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
                                                         ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -