Submission #1102975

#TimeUsernameProblemLanguageResultExecution timeMemory
1102975PioneerSorting (IOI15_sorting)C++17
0 / 100
2 ms512 KiB
#include "sorting.h" #include <bits/stdc++.h> using namespace std; const int MAX=200000; int n,m; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { n=N,m=M; vector<pair<int,int>> swaps; for(int i=0;i<n;i++){ if(S[i]==i)swaps.push_back({0,0}); else{ for(int j=i+1;j<n;j++){ if(S[j]==i){ swaps.push_back({i,j}); swap(S[i],S[j]); } } } } for(int i=0;i<swaps.size();i++){ P[i]=swaps[i].first; Q[i]=swaps[i].second; } return swaps.size(); }

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:24:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for(int i=0;i<swaps.size();i++){
      |              ~^~~~~~~~~~~~~
sorting.cpp:28:19: warning: conversion from 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   28 |  return swaps.size();
      |         ~~~~~~~~~~^~
sorting.cpp:10:46: warning: unused parameter 'X' [-Wunused-parameter]
   10 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
      |                                          ~~~~^~~
sorting.cpp:10:55: warning: unused parameter 'Y' [-Wunused-parameter]
   10 | 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...