Submission #1857307


Source Code Expand

#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=1e9+7;
const llint big=1e15+100;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
int main(void){
	int i,n;cin>>n;
	vector<int>p(n);for(auto &it:p){cin>>it;}
	vector<int>sosa;
	while(-1){
		for(i=0;i<n;i++){
			sosa.pub(1);
			if(i==n-1){continue;}
			if(p[i]>p[i+1]){sosa.pub(n-1);swap(p[i+1],p[i]);}
		}
		int ok=1;
		for(i=0;i<n;i++){if(p[i]!=i){ok=0;break;}}
		if(ok==1){break;}
	}
	cout<<sosa.size()<<endl;
	for(auto it:sosa){cout<<it<<endl;}
	return 0;
}

Submission Info

Submission Time
Task A - Colorful MST
User WA_TLE
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1696 Byte
Status TLE
Exec Time 2109 ms
Memory 2061004 KB

Judge Result

Set Name Sample Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 0 / 0 0 / 100 0 / 100 0 / 200 0 / 300
Status
TLE × 4
TLE × 7
TLE × 12
TLE × 7
TLE × 28
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 00_example_04.txt
Subtask1 00_example_03.txt, s1_01.txt, s1_02.txt, s1_03.txt, s1_04.txt, s1_05.txt, s1_06.txt
Subtask2 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, s2_12.txt
Subtask3 00_example_02.txt, s3_13.txt, s3_14.txt, s3_15.txt, s3_16.txt, s3_17.txt, s3_18.txt
Subtask4 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 00_example_04.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, s2_12.txt, s3_13.txt, s3_14.txt, s3_15.txt, s3_16.txt, s3_17.txt, s3_18.txt, s4_19.txt, s4_20.txt, s4_21.txt, s4_22.txt, s4_23.txt, s4_24.txt
Case Name Status Exec Time Memory
00_example_01.txt TLE 2106 ms -2095924 KB
00_example_02.txt TLE 2106 ms -2095668 KB
00_example_03.txt TLE 2107 ms -2096692 KB
00_example_04.txt TLE 2107 ms -2095156 KB
s1_01.txt TLE 2107 ms -2095412 KB
s1_02.txt TLE 2107 ms -2094900 KB
s1_03.txt TLE 2107 ms -2095924 KB
s1_04.txt TLE 2107 ms -2096564 KB
s1_05.txt TLE 2107 ms -2095412 KB
s1_06.txt TLE 2107 ms -2096308 KB
s2_07.txt TLE 2109 ms 2061004 KB
s2_08.txt TLE 2107 ms -2095668 KB
s2_09.txt TLE 2107 ms -2095156 KB
s2_10.txt TLE 2107 ms -2094644 KB
s2_11.txt TLE 2107 ms -2096308 KB
s2_12.txt TLE 2107 ms -2095028 KB
s3_13.txt TLE 2108 ms -2095668 KB
s3_14.txt TLE 2107 ms -2095924 KB
s3_15.txt TLE 2107 ms -2094900 KB
s3_16.txt TLE 2107 ms -2095412 KB
s3_17.txt TLE 2107 ms -2095796 KB
s3_18.txt TLE 2107 ms -2095284 KB
s4_19.txt TLE 2106 ms -2095924 KB
s4_20.txt TLE 2107 ms -2095540 KB
s4_21.txt TLE 2107 ms -2095924 KB
s4_22.txt TLE 2107 ms -2095412 KB
s4_23.txt TLE 2107 ms -2095540 KB
s4_24.txt TLE 2108 ms -2094516 KB