11650번 - 좌표 정렬하기
#include
int Sort (int a[],int b[],int n){
int temp1;
int temp2;
for (int i=0; ia[j+1]){
temp1 = a[j];
a[j] = a[j+1];
a[j+1] = temp1;
temp1=0;
temp2 = b[j];
b[j] = b[j+1];
b[j+1] = temp2;
temp2=0;
}
else if (a[j]==a[j+1]){
if (b[j]>b[j+1]){
int main() {
int a;
scanf("%d",&a);
int b[100001];
int c[100001];
for (int i=0; i
N이 10만이면 시간초과가 날 수밖에 없겟네요
https://www.acmicpc.net/board/...
바로 전 게시글에 동일한 질문이 올라왔습니다
댓글을 작성하려면 로그인해야 합니다.
scg9767 2년 전
#include
int Sort (int a[],int b[],int n){
int temp1;
int temp2;
for (int i=0; ia[j+1]){
temp1 = a[j];
a[j] = a[j+1];
a[j+1] = temp1;
temp1=0;
temp2 = b[j];
b[j] = b[j+1];
b[j+1] = temp2;
temp2=0;
}
else if (a[j]==a[j+1]){
if (b[j]>b[j+1]){
temp2 = b[j];
b[j] = b[j+1];
b[j+1] = temp2;
temp2=0;
temp1 = a[j];
a[j] = a[j+1];
a[j+1] = temp1;
temp1=0;
}
}
}
int main() {
int a;
scanf("%d",&a);
int b[100001];
int c[100001];
for (int i=0; i