Submission #2901967


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

vector <int> V;
int A[222];
int n;

int main()
{
	int i, j, t;
	
	scanf("%d", &n);
	
	for(i=1; i<=n; i++){
		scanf("%d", A+i);
	}
	
	for(i=1; i<=n; i++){
		t = 1;
		for(j=1; j<n; j++){
			if(A[i] > A[i+1]){
				for(; t<i+1; t++) V.push_back(1);
				swap(A[i], A[i+1]);
				V.push_back(n);
			}
		}
		for(; t<=n; t++) V.push_back(1);
	}
	
	printf("%d\n", (int)V.size());
	
	for(int t: V) printf("%d\n", t);
	
	return 0;
}

Submission Info

Submission Time
Task B - Many Swaps Sorting
User SebinKim
Language C++14 (GCC 5.4.1)
Score 0
Code Size 503 Byte
Status WA
Exec Time 4 ms
Memory 640 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:13:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
./Main.cpp:16:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", A+i);
                   ^

Judge Result

Set Name Sample Subtask1 Subtask2 All
Score / Max Score 0 / 0 0 / 300 0 / 400 0 / 200
Status
WA × 2
WA × 7
WA × 13
WA × 22
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt
Subtask1 00_example_01.txt, s1_01.txt, s1_02.txt, s1_03.txt, s1_04.txt, s1_05.txt, s1_06.txt
Subtask2 00_example_01.txt, 00_example_02.txt, s1_01.txt, s1_02.txt, s1_03.txt, s1_04.txt, s1_05.txt, s1_06.txt, s2_07.txt, s2_08.txt, s2_09.txt, s2_10.txt, s2_11.txt
All 00_example_01.txt, 00_example_02.txt, s1_01.txt, s1_02.txt, s1_03.txt, s1_04.txt, s1_05.txt, s1_06.txt, s2_07.txt, s2_08.txt, s2_09.txt, s2_10.txt, s2_11.txt, s3_12.txt, s3_13.txt, s3_14.txt, s3_15.txt, s3_16.txt, s3_17.txt, s3_18.txt, s3_19.txt, s3_20.txt
Case Name Status Exec Time Memory
00_example_01.txt WA 1 ms 256 KB
00_example_02.txt WA 1 ms 256 KB
s1_01.txt WA 1 ms 256 KB
s1_02.txt WA 1 ms 256 KB
s1_03.txt WA 1 ms 256 KB
s1_04.txt WA 1 ms 256 KB
s1_05.txt WA 1 ms 256 KB
s1_06.txt WA 1 ms 256 KB
s2_07.txt WA 1 ms 256 KB
s2_08.txt WA 1 ms 256 KB
s2_09.txt WA 1 ms 256 KB
s2_10.txt WA 1 ms 256 KB
s2_11.txt WA 1 ms 256 KB
s3_12.txt WA 2 ms 384 KB
s3_13.txt WA 3 ms 512 KB
s3_14.txt WA 2 ms 256 KB
s3_15.txt WA 2 ms 256 KB
s3_16.txt WA 4 ms 640 KB
s3_17.txt WA 4 ms 640 KB
s3_18.txt WA 4 ms 640 KB
s3_19.txt WA 4 ms 640 KB
s3_20.txt WA 4 ms 640 KB