Submission #552872

#TimeUsernameProblemLanguageResultExecution timeMemory
552872elazarkorenSorting (IOI15_sorting)C++17
16 / 100
3 ms340 KiB
#include "sorting.h" #include <bits/stdc++.h> #define x first #define y second #define all(v) v.begin(), v.end() #define chkmin(a, b) a = min(a, b) #define chkmax(a, b) a = max(a, b) //#define int ll using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; typedef pair<int, int> pii; typedef vector<pii> vii; typedef vector<bool> vb; int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) { int cnt = 0; for (int i = 2; i < n; i++) { if (s[i] != i) { swap(s[0], s[1]); for (int j = 0; j < n; j++) { if (s[j] == i) { p[cnt] = i, q[cnt] = j; cnt++; swap(s[i], s[j]); break; } } // for (int i = 0; i < n; i++) cout << s[i] << ' '; // cout << '\n'; } } if (s[0]) { swap(s[0], s[1]); p[cnt] = q[cnt] = 0; cnt++; // for (int i = 0; i < n; i++) cout << s[i] << ' '; // cout << '\n'; } return cnt; } //8 //3 5 6 2 1 7 0 4 //8 //0 1 //0 1 //0 1 //0 1 //0 1 //0 1 //0 1 //0 1

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:17:39: warning: unused parameter 'm' [-Wunused-parameter]
   17 | int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
      |                                   ~~~~^
sorting.cpp:3:11: warning: unused parameter 'first' [-Wunused-parameter]
    3 | #define x first
      |           ^
sorting.cpp:17:46: note: in expansion of macro 'x'
   17 | int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
      |                                              ^
sorting.cpp:4:11: warning: unused parameter 'second' [-Wunused-parameter]
    4 | #define y second
      |           ^
sorting.cpp:17:55: note: in expansion of macro 'y'
   17 | 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...