Submission #432974

#TimeUsernameProblemLanguageResultExecution timeMemory
432974wiwihoSorting (IOI15_sorting)C++14
20 / 100
1 ms332 KiB
#include "sorting.h" #include <bits/stdc++.h> #define printv(a, b) { \ for(auto pv : a) b << pv << " "; \ b << "\n"; \ } #define mp make_pair #define F first #define Sc second #define eb emplace_back using namespace std; typedef long long ll; using pii = pair<int, int>; const ll MOD = 1000000007; int findSwapPairs(int n, int S[], int m, int X[], int Y[], int P[], int Q[]) { vector<pii> ans; for(int i = 0; i < n; i++){ while(S[i] != i){ ans.eb(i, S[i]); swap(S[i], S[S[i]]); } } for(int i = 0; i < ans.size(); i++){ P[i] = ans[i].F; Q[i] = ans[i].Sc; } return ans.size(); }

Compilation message (stderr)

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