Submission #1108067

#TimeUsernameProblemLanguageResultExecution timeMemory
1108067AvianshSorting (IOI15_sorting)C++17
0 / 100
2 ms336 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[]) { int r = 0; for(int i = 0;i<n;i++){ int ind = find(s+i,s+n,i)-s; swap(s[i],s[ind]); if(i!=ind){ p[r]=i; q[r]=ind; r++; } } for(;r<m-5;r++){ p[r]=0; q[r]=0; } for(int i = 0;i<n;i++){ assert(s[i]==i); } return r; }

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:9:34: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
    9 |         int ind = find(s+i,s+n,i)-s;
      |                   ~~~~~~~~~~~~~~~^~
sorting.cpp:6:46: warning: unused parameter 'x' [-Wunused-parameter]
    6 | int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
      |                                          ~~~~^~~
sorting.cpp:6:55: warning: unused parameter 'y' [-Wunused-parameter]
    6 | 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...