제출 #202808

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
2028082020-02-18 00:50:20spdskatr정렬하기 (IOI15_sorting)C++14
74 / 100
213 ms21868 KiB
#include "sorting.h"
#include <cstring>
#include <vector>
#include <utility>
#include <cassert>
#include <cstdio>
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
int N, M, s[1000005], x[1000005], y[1000005], state[1000005], seen[1000005], pos[1000005];
vector<pii> swaps;
int check(int steps) {
for (int i = 0; i < N; i++) state[i] = s[i];
for (int i = 0; i < steps; i++) {
if (x[i] != y[i]) {
swap(state[x[i]], state[y[i]]);
}
}
int cycles = 0;
for (int i = 0; i < N; i++) {
if (!seen[i]) {
seen[i] = 1;
cycles++;
int cur = state[i];
while (cur != i) {
seen[cur] = 1;
cur = state[cur];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

sorting.cpp: In function 'int check(int)':
sorting.cpp:34:6: warning: declaration of 'swaps' shadows a global declaration [-Wshadow]
  int swaps = N - cycles;
      ^~~~~
sorting.cpp:13:13: note: shadowed declaration is here
 vector<pii> swaps;
             ^~~~~
sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:73:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int j = 0; j < swaps.size(); j++) {
                     ~~^~~~~~~~~~~~~~
#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...