# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
466459 | myvaluska | Xor Sort (eJOI20_xorsort) | C++14 | 0 ms | 204 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// palindromefree.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
//long long int cifra[20];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
int s;
cin >> n;
cin >> s;
vector<int>v(n);
for (int i = 0; i < n; i++)
{
cin >> v[i];
}
vector<pair<int, int>>vys;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n-1; j++)
{
if (v[j] > v[j + 1])
{
vys.push_back({ j,j + 1 });
vys.push_back({ j + 1,j });
swap(v[j], v[j + 1]);
}
}
}
cout << vys.size() << endl;
for (int i = 0; i < vys.size(); i++)
{
cout << vys[i].first + 1 << ' ';
cout << vys[i].second + 1 << endl;
}
return 0;
//std::cout << "Hello World!\n";
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |