Submission #283337

#TimeUsernameProblemLanguageResultExecution timeMemory
283337stoyan_malininSorting (IOI15_sorting)C++14
0 / 100
1 ms384 KiB
#include "sorting.h" //#include "grader.cpp" #include <vector> #include <assert.h> #include <iostream> using namespace std; int guessSubtask(int m, int *x, int *y) { bool subtask2 = true; for(int i = 0;i<m;i++) { if(!(x[i]==0 && y[i]==0)) { subtask2 = false; break; } } if(subtask2==true) return 2; } int solve2(int n, int *s, int *p, int *q) { for(int i = 0;i<n;i++) { for(int j = i;j<n;j++) { if(s[j]==i) { swap(s[i], s[j]); p[i] = i; q[i] = j; break; } } } return n; } int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { int subtask = guessSubtask(M, X, Y); if(subtask==2) return solve2(N, S, P, Q); assert(false); } /* 4 3 2 1 0 5 0 0 0 0 0 0 0 0 0 0 */

Compilation message (stderr)

sorting.cpp: In function 'int guessSubtask(int, int*, int*)':
sorting.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type]
   22 | }
      | ^
#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...