답안 #774786

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
774786 2023-07-06T03:25:08 Z vjudge1 Xor Sort (eJOI20_xorsort) C++14
0 / 100
633 ms 524288 KB
//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("bmi,bmi2,lzcnt,popcnt")
//#pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native")
//#pragma expected_value
//#pragma isolated_call
//#pragma disjoint

#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

//using namespace __gnu_pbds;
using namespace std;

//#define int long long
//#define double long double
#define Fi first
#define Se second
#define Rep(i,a,b) for (int i=a;i<=b;++i)
#define Repu(i,b,a) for (int i=b;i>=a;--i)
#define pb push_back
#define ms(a,i) memset(a,i,sizeof(a))
#define sz size()
#define mp make_pair
#define endl '\n'
#define sef setprecision(6)<<fixed
#define cer cout<<"cak"<<endl;

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<double> va;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<va> vva;

//const double EPS=1e-9;
const double PI=acos(-1);
const long long oo=1e18;
const int MN=2e5+5;
const int mod=1e9+7;

using cd=complex<double>;

//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> index_set;

int n,s;
int a[1005];

vii ans;

int check() {
	Rep(i,1,n-1) if(a[i]>=a[i+1]) return i;
	return 0;
}

signed main() {
  	//freopen(".inp","r",stdin); freopen(".out","w",stdout);
  	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	cin>>n>>s;
	Rep(i,1,n) cin>>a[i];

	int temp=check();
	while(temp) {
		int val = (a[temp]^a[temp+1]);
		if(val>a[temp]) {
			a[temp+1] = val;
			ans.pb({temp+1,temp});
		}
		else {
			a[temp] = val;
			ans.pb({temp,temp+1});
		}
		temp=check();
	}

	cout<<ans.sz<<endl;
	for(ii itr:ans) cout<<itr.Fi<<' '<<itr.Se<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 620 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 620 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 633 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -