Submission #1053679

#TimeUsernameProblemLanguageResultExecution timeMemory
1053679XJP12Sorting (IOI15_sorting)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "sorting.h" using namespace std; typedef vector<int> vi; int findSwapPairs(int n, vi s, int m, vi x, vi y, vi p, vi q) { int r=0; if(y[0]==1){ for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ if(s[j]==i && j!=i){ p[i]=j; q[i]=i; swap(s[i], s[j]); r++; break; } } swap(s[1], s[0]); } if(s[1]!=1 && s[0]!=0){ p[i]=0; q[i]=1; r++; } }else{ for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ if(s[j]==i && j!=i){ p[i]=j; q[i]=i; swap(s[i], s[j]); r++; break; } } } } return r; }

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, vi, int, vi, vi, vi, vi)':
sorting.cpp:21:6: error: 'i' was not declared in this scope
   21 |    p[i]=0;
      |      ^
sorting.cpp:5:36: warning: unused parameter 'm' [-Wunused-parameter]
    5 | int findSwapPairs(int n, vi s, int m, vi x, vi y, vi p, vi q) {
      |                                ~~~~^
sorting.cpp:5:42: warning: unused parameter 'x' [-Wunused-parameter]
    5 | int findSwapPairs(int n, vi s, int m, vi x, vi y, vi p, vi q) {
      |                                       ~~~^