Submission #812304

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8123042023-08-07 08:17:30LIFSorting (IOI15_sorting)C++14
100 / 100
139 ms28516 KiB
#include "sorting.h"
#include<bits/stdc++.h>
using namespace std;
int a[300005];
vector<pair<int,int> > last;
int pos[300005];
int AA[300005][2];
int val[300005][2];
vector<pair<int,int> > pp;
bool check(int now,int X[],int Y[],int N,int S[])
{
for(int i=0;i<N;i++)a[i] = S[i];
for(int i=0;i<now;i++)swap(a[X[i]],a[Y[i]]);
for(int i=0;i<N;i++)pos[a[i]] = i;
int ans = 0;
vector<pair<int,int> > temp;
for(int i=0;i<N;i++)
{
if(a[i] == i)continue;
int aa = i;
int bb = pos[i];
swap(a[aa],a[bb]);
pos[a[bb]] = bb;
temp.push_back(make_pair(aa,bb));
ans++;
}
if(temp.size() > now)return false;
if(temp.size() < now)for(int i=1;i<= now-temp.size();i++)temp.push_back(make_pair(0,0));
if(ans <= now)
{
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

sorting.cpp: In function 'bool check(int, int*, int*, int, int*)':
sorting.cpp:27:17: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |  if(temp.size() > now)return false;
      |     ~~~~~~~~~~~~^~~~~
sorting.cpp:28:17: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |  if(temp.size() < now)for(int i=1;i<= now-temp.size();i++)temp.push_back(make_pair(0,0));
      |     ~~~~~~~~~~~~^~~~~
sorting.cpp:28:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  if(temp.size() < now)for(int i=1;i<= now-temp.size();i++)temp.push_back(make_pair(0,0));
      |                                   ~^~~~~~~~~~~~~~~~~~
#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...