Submission #105053

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1050532019-04-10 10:20:44Alexa2001Sorting (IOI15_sorting)C++17
100 / 100
722 ms29380 KiB
#include "sorting.h"
#include <bits/stdc++.h>
using namespace std;
const int Nmax = 2e5 + 5;
bool used[Nmax];
int p[Nmax], P[Nmax], A[Nmax], wA[Nmax], B[Nmax], wB[Nmax], wp[Nmax];
vector< pair<int,int> > get_moves(int n, int p[])
{
int i;
for(i=0; i<n; ++i) used[i] = 0;
vector< pair<int,int> > mv;
for(i=0; i<n; ++i)
if(!used[i])
{
int x = i;
vector<int> cycle;
do
{
used[x] = 1;
cycle.push_back(x);
x = p[x];
}
while(!used[x]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

sorting.cpp: In function 'std::vector<std::pair<int, int> > get_moves(int, int*)':
sorting.cpp:12:49: warning: declaration of 'p' shadows a global declaration [-Wshadow]
 vector< pair<int,int> > get_moves(int n, int p[])
                                                 ^
sorting.cpp:9:5: note: shadowed declaration is here
 int p[Nmax], P[Nmax], A[Nmax], wA[Nmax], B[Nmax], wB[Nmax], wp[Nmax];
     ^
sorting.cpp:32:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int j = 0; j + 1 < cycle.size(); ++j)
                            ~~~~~~^~~~~~~~~~~~~~
sorting.cpp: In function 'bool check(int, int, int*, int*, int*, int*, int*)':
sorting.cpp:54:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(o.size() > m) return 0;
        ~~~~~~~~~^~~
sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:81:76: warning: declaration of 'P' shadows a global declaration [-Wshadow]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[])
                                                                            ^
sorting.cpp:9:14: note: shadowed declaration is here
 int p[Nmax], P[Nmax], A[Nmax], wA[Nmax], B[Nmax], wB[Nmax], wp[Nmax];
              ^
#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...