Submission #1080915

#TimeUsernameProblemLanguageResultExecution timeMemory
1080915TrumlingSorting (IOI15_sorting)C++14
0 / 100
2 ms348 KiB
#include "sorting.h" #include<bits/stdc++.h> using namespace std; #define F first #define S second #define pb push_back #define all(x) x.begin(),x.end() #define INF 9999999999999999 typedef long long ll; ll n; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { n=N; ll pos[N]; for(int i=0;i<N;i++) pos[S[i]]=i; int i; for(i=0;i<N;i++) { bool tf=1; for(int j=0;j<N;j++) if(S[j]!=j) tf=0; if(tf) break; P[i]=pos[i]; Q[i]=i; swap(S[pos[i]],S[i]); pos[S[pos[i]]]=pos[i]; pos[i]=i; } return i+1; }

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:30:13: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   30 |   P[i]=pos[i];
      |        ~~~~~^
sorting.cpp:13:39: warning: unused parameter 'M' [-Wunused-parameter]
   13 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[])
      |                                   ~~~~^
sorting.cpp:13:46: warning: unused parameter 'X' [-Wunused-parameter]
   13 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[])
      |                                          ~~~~^~~
sorting.cpp:13:55: warning: unused parameter 'Y' [-Wunused-parameter]
   13 | 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...