Submission #621031

#TimeUsernameProblemLanguageResultExecution timeMemory
621031aminSorting (IOI15_sorting)C++14
0 / 100
3 ms340 KiB
#include "sorting.h" #include<bits/stdc++.h> using namespace std; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { long o=0; for(long i=0;i<N;i++) { long p=0; swap(S[0],S[1]); for(long y=0;y<N;y++) { if(S[y]!=y) { p=1; break; } } if(p==0) break; for(long y=0;y<N;y++) { if(S[y]==i) {if(i!=y) { if(i==1) { swap(S[y],S[i-1]); P[o]=i-1; Q[o]=y; }else { swap(S[y],S[i]); P[o]=i; Q[o]=y; } o++; } break; } } } if(S[0]!=0) { P[o]=0; Q[o]=1; o++; } return o; }

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:19:8: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   19 |        if(p==0)
      |        ^~
sorting.cpp:21:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   21 |         for(long y=0;y<N;y++)
      |         ^~~
sorting.cpp:32:23: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   32 |                 P[o]=i-1;
      |                      ~^~
sorting.cpp:33:22: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   33 |                 Q[o]=y;
      |                      ^
sorting.cpp:37:22: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   37 |                 P[o]=i;
      |                      ^
sorting.cpp:38:22: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   38 |                 Q[o]=y;
      |                      ^
sorting.cpp:54:12: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
   54 |     return o;
      |            ^
sorting.cpp:4:39: warning: unused parameter 'M' [-Wunused-parameter]
    4 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
      |                                   ~~~~^
sorting.cpp:4:46: warning: unused parameter 'X' [-Wunused-parameter]
    4 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
      |                                          ~~~~^~~
sorting.cpp:4:55: warning: unused parameter 'Y' [-Wunused-parameter]
    4 | 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...