답안 #206030

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
206030 2020-03-02T01:54:48 Z Segtree 정렬하기 (IOI15_sorting) C++14
20 / 100
7 ms 504 KB
#include"sorting.h"
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define all(x) x,begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
int findSwapPairs(int N,int S[],int M,int X[],int Y[],int P[],int Q[]){
	int R=0;
	for(int i=0;i<N;i++){
		ll p;
		for(int j=0;j<N;j++)if(S[j]==i)p=j;
		if(i!=p){
			P[R]=i,Q[R]=p,R++;
			swap(S[i],S[p]);
		}
	}
	//rep(i,R)cout<<"PQ:"<<P[i]<<" "<<Q[i]<<endl;
	return R;
}
/*
int main(){
	int n,s[100],m,x[1000],y[1000],p[1000],q[1000];
	cin>>n;
	rep(i,n)cin>>s[i];
	cin>>m;
	rep(i,m){
		cin>>x[i]>>y[i];
	}
	cout<<"R="<<findSwapPairs(n,s,m,x,y,p,q)<<endl;
}*/


Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:20:16: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
    P[R]=i,Q[R]=p,R++;
                ^
sorting.cpp:14:37: warning: unused parameter 'M' [-Wunused-parameter]
 int findSwapPairs(int N,int S[],int M,int X[],int Y[],int P[],int Q[]){
                                     ^
sorting.cpp:14:45: warning: unused parameter 'X' [-Wunused-parameter]
 int findSwapPairs(int N,int S[],int M,int X[],int Y[],int P[],int Q[]){
                                             ^
sorting.cpp:14:53: warning: unused parameter 'Y' [-Wunused-parameter]
 int findSwapPairs(int N,int S[],int M,int X[],int Y[],int P[],int Q[]){
                                                     ^
sorting.cpp:19:3: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
   if(i!=p){
   ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 380 KB Output is correct
12 Correct 5 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 5 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 380 KB Output is correct
12 Correct 5 ms 504 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Incorrect 5 ms 256 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -