Submission #126173

#TimeUsernameProblemLanguageResultExecution timeMemory
126173SOIVIEONESorting (IOI15_sorting)C++14
0 / 100
3 ms632 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...