Submission #580007

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5800072022-06-20 13:15:57AugustinasJucasSorting (IOI15_sorting)C++14
0 / 100
255 ms14632 KiB
#include "sorting.h"
#include <bits/stdc++.h>
using namespace std;
int n; int m;
vector<int> mas;
vector<pair<int, int> > swaps;
vector<int> simuliuok(int kiek) {
vector<int> ret(n);
for(int i = 0; i < n; i++) ret[i] = i;
for(int i = 0; i < kiek; i++) {
swap(ret[swaps[i].first], ret[swaps[i].second]);
}
return ret;
}
vector<int> iKuriaLekstutePerkelti(int kiek){
vector<int> kuriLekstuteCiaAtsidurs = simuliuok(kiek);
// cout << "simluliantas: "; for(auto &x : kuriLekstuteCiaAtsidurs) cout << x << " ";
// cout << endl;
vector<int> kurEisiu (n);
for(int i = 0; i < n; i++) {
kurEisiu[i] = kuriLekstuteCiaAtsidurs[mas[i]];
}
return kurEisiu;
}
bool f(int kiek) {
vector<int> kurEisiu = iKuriaLekstutePerkelti(kiek);
vector<bool> vis(n, false);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

sorting.cpp: In function 'std::vector<std::pair<int, int> > raskEiliskuma(std::vector<int>)':
sorting.cpp:55:17: warning: declaration of 'i' shadows a previous local [-Wshadow]
   55 |         for(int i = ratas.size() - 1; i > 0; i--) {
      |                 ^
sorting.cpp:45:13: note: shadowed declaration is here
   45 |     for(int i = 0; i < n; i++) {
      |             ^
sorting.cpp:55:34: warning: conversion from 'std::vector<int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   55 |         for(int i = ratas.size() - 1; i > 0; i--) {
      |                     ~~~~~~~~~~~~~^~~
sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:98:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   98 |         if(i >= eiliskumas.size()) A = B = 0;
      |            ~~^~~~~~~~~~~~~~~~~~~~
sorting.cpp:106:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  106 |         for(auto x : lekstute) cout << x << " "; cout << endl;
      |         ^~~
sorting.cpp:106:50: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  106 |         for(auto x : lekstute) cout << x << " "; cout << endl;
      |                                                  ^~~~
sorting.cpp:69:9: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   69 |     int ans;
      |         ^~~
#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...