제출 #1039872

#제출 시각아이디문제언어결과실행 시간메모리
1039872Zicrus정렬하기 (IOI15_sorting)C++17
20 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include "sorting.h" using namespace std; typedef long long ll; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { ll stkPtr = 0; vector<ll> s(N); for (int i = 0; i < N; i++) s[i] = S[i]; for (int i = 2; i < min(N, M); i++) { swap(s[X[i]], s[Y[i]]); ll id = find(s.begin(), s.end(), i) - s.begin(); if (i == id) { swap(s[X[i]], s[Y[i]]); continue; } swap(s[i], s[id]); P[stkPtr] = i; Q[stkPtr] = id; stkPtr++; } if (stkPtr < M) { if (s[0] == 0) { P[stkPtr] = 0; Q[stkPtr] = 0; stkPtr++; } else { P[stkPtr] = 0; Q[stkPtr] = 1; stkPtr++; } } return stkPtr; }

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

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:17:21: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   17 |         Q[stkPtr] = id;
      |                     ^~
sorting.cpp:32:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   32 |  return stkPtr;
      |         ^~~~~~
#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...