답안 #1080986

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1080986 2024-08-29T16:39:24 Z Trumling 정렬하기 (IOI15_sorting) C++14
20 / 100
30 ms 26040 KB
#include "sorting.h"
#include<bits/stdc++.h>
using namespace std;
     
#define F first
#define S second
#define pb push_back
#define all(x) x.begin(),x.end()
#define INF 9999999999999999
typedef long long ll;
ll n;

int findSwapPairs(int N, int Se[], int M, int X[], int Y[], int P[], int Q[]) 
{ 
	n=N;
	vector<pair<ll,ll>>v;
	for(int i=0;i<N;i++)
		for(int j=0;j<N;j++)
			if(Se[j]==i)
			{
				for(int c=j-1;c>=i;c--)
					{
						swap(Se[c],Se[c+1]);
						v.pb({c,c+1});
					}
			}
	
	for(int i=0;i<v.size();i++)
		{
			P[i]=v[i].F;
			Q[i]=v[i].S;
		}

	return v.size();
		
}

Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:28:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  for(int i=0;i<v.size();i++)
      |              ~^~~~~~~~~
sorting.cpp:5:11: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
    5 | #define F first
sorting.cpp:30:14: note: in expansion of macro 'F'
   30 |    P[i]=v[i].F;
      |              ^
sorting.cpp:6:11: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
    6 | #define S second
sorting.cpp:31:14: note: in expansion of macro 'S'
   31 |    Q[i]=v[i].S;
      |              ^
sorting.cpp:34:15: warning: conversion from 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   34 |  return v.size();
      |         ~~~~~~^~
sorting.cpp:13:40: warning: unused parameter 'M' [-Wunused-parameter]
   13 | int findSwapPairs(int N, int Se[], int M, int X[], int Y[], int P[], int Q[])
      |                                    ~~~~^
sorting.cpp:13:47: warning: unused parameter 'X' [-Wunused-parameter]
   13 | int findSwapPairs(int N, int Se[], int M, int X[], int Y[], int P[], int Q[])
      |                                           ~~~~^~~
sorting.cpp:13:56: warning: unused parameter 'Y' [-Wunused-parameter]
   13 | int findSwapPairs(int N, int Se[], int M, int X[], int Y[], int P[], int Q[])
      |                                                    ~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 1 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Incorrect 0 ms 348 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 30 ms 26040 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 30 ms 26040 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -