QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#321173#8215. Isomorphic Delightucup-team008#AC ✓110ms71404kbC++2313.6kb2024-02-04 06:03:422024-02-04 06:03:44

Judging History

你现在查看的是最新测评结果

  • [2024-02-04 06:03:44]
  • 评测
  • 测评结果:AC
  • 用时:110ms
  • 内存:71404kb
  • [2024-02-04 06:03:42]
  • 提交

answer

// {{{ y0105w49 template 22M14
// hi mom
#ifndef NULL
#ifdef __GNUC__
#ifndef __clang__
// #include <bits/stdc++.h>
#include <bits/extc++.h>
#include <tr2/dynamic_bitset>
#define EXTS
#else
#ifdef ARST
#include <bits/clang++.h>
#else
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
// #include <cuchar>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#if __cplusplus >= 201402L
#include <shared_mutex>
#endif
#if __cplusplus >= 201703L
#include <any>
#include <charconv>
// #include <execution>
#include <filesystem>
#include <optional>
// #include <memory_resource>
#include <string_view>
#include <variant>
#endif
#if __cplusplus >= 202002L
#include <barrier>
#include <bit>
#include <compare>
#include <concepts>
#if __cpp_impl_coroutine
# include <coroutine>
#endif
#include <latch>
#include <numbers>
#include <ranges>
#include <span>
// #include <stop_token>
#include <semaphore>
// #include <source_location>
// #include <syncstream>
#include <version>
#endif
#if __cplusplus > 202002L
// #include <expected>
// #include <spanstream>
#if __has_include(<stacktrace>)
# include <stacktrace>
#endif
#include <stdatomic.h>
#endif
#endif
#endif
#else
#error "unsupported"
#endif
#endif
using namespace std;
#ifdef ARST
#define JO 1
#define OJ 0
#else
#define JO 0
#define OJ 1
#endif
#define STR(x) #x
#define GCCDIAG(s) _Pragma(STR(GCC diagnostic s)) static_assert(true)
#define Wsave GCCDIAG(push)
#define Wpop GCCDIAG(pop)
#define Wsupp(w) GCCDIAG(ignored "-W" w)
#define Wpush(w) Wsave; Wsupp(w)
#define typeof __typeof__
namespace gbd_ns {
	template<typename C>
	struct is_iterable {
		template<class T> static long check(...);
		template<class T> static char check(int,typename T::const_iterator = C().end());
		enum {
			value = sizeof(check<C>(0)) == sizeof(char),
			neg_value = sizeof(check<C>(0)) != sizeof(char)
		};
	};
	template<class T> struct _gbd3C;
	template<class T> ostream &_gbd3(ostream &os,const T &x) { return _gbd3C<T>::call(os,x); }
	template<> ostream &_gbd3(ostream &os,const string &x) { return os<<'"'<<x<<'"'; }
	template<> ostream &_gbd3(ostream &os,char *const &x) { return os<<'"'<<x<<'"'; }
	template<class T> ostream &_gbd3_5(ostream &os,const T &x) { return _gbd3(os,x); }
	template<class A,class B>
	ostream &_gbd4(ostream &os,const pair<A,B> &p) {
		_gbd3(os<<'(',p.first);
		_gbd3(os<<',',p.second);
		return os<<')';
	}
	template<class T,size_t N> struct _gbd4_tupleC {
		static void call(ostream &os,const T &t) {
			_gbd4_tupleC<T,N-1>::call(os,t);
			os<<','<<get<N-1>(t);
		}
	};
	template<class T> struct _gbd4_tupleC<T,1> {
		static void call(ostream &os,const T &t) {
			os<<get<0>(t);
		}
	};
	template<typename... Types>
	ostream &_gbd4(ostream &os,const tuple<Types...> &t) {
		os<<'(';
		_gbd4_tupleC<tuple<Types...>,sizeof...(Types)>::call(os,t);
		return os<<')';
	}
	template<>
	ostream &_gbd4(ostream &os,const tuple<> &t) { (void)t; return os<<"()"; }
	template<class T> ostream &_gbd4(ostream &os,const T &x) {
		return os<<x;
	}
	template<class T> struct _gbd3C {
		template<class U=T>
		static ostream &call(ostream &os,enable_if_t<is_iterable<U>::value,const T> &V) {
			os<<"{";
			bool ff=0;
			for(const auto &E:V) _gbd3_5<decltype(E)>(ff?os<<",":os,E), ff=1;
			return os<<"}";
		}
		template<class U=T>
		static ostream &call(ostream &os,enable_if_t<is_iterable<U>::neg_value,const T> &x) {
			return _gbd4(os,x);
		}
	};
	template<class T,typename... Args> ostream &_gbd2(ostream &os,bool,vector<string>::iterator nm,const T &x,Args&&... args);
	ostream &_gbd2(ostream &os,bool,vector<string>::iterator) { return os; }
	template<typename... Args>
	ostream &_gbd2(ostream &os,bool fi,vector<string>::iterator nm,const char *x,Args&&... args) {
		return _gbd2(os<<(fi?"":"  ")<<x,0,nm+1,args...);
	}
	template<class T,typename... Args>
	ostream &_gbd2(ostream &os,bool fi,vector<string>::iterator nm,const T &x,Args&&... args) {
		return _gbd2(_gbd3<T>(os<<(fi?"":"  ")<<*nm<<"=",x),0,nm+1,args...);
	}
	vector<string> split(string s) {
		vector<string> Z;
		string z="";
		s+=',';
		int dep=0;
		for(char c:s) {
			if(c==',' && !dep) Z.push_back(z),z="";
			else z+=c;
			if(c=='(' || c=='{' || c=='[') ++dep;
			if(c==')' || c=='}' || c==']') --dep;
		}
		return Z;
	}
	template<typename... Args> ostream &_gbd1(ostream &os,const string &nm,Args&&... args) {
		return _gbd2(os,1,split(nm).begin(),args...);
	}
	template<typename... Args> string _gbd1(const string &nm,Args&&... args) {
		ostringstream oss;
		_gbd2(oss,1,split(nm).begin(),args...);
		return oss.str();
	}
}
bool DBG=1,EMACS=0;
#define dbg(...) (JO&&DBG?gbd_ns::_gbd1(cerr<<"\033[38;5;5m"<<__FILE__<<":"<<__LINE__<<(EMACS?":note: ":": "),#__VA_ARGS__,__VA_ARGS__)<<"\033[0m"<<endl:cerr)
#define dbgt(...) dbg(fmt_time(),__VA_ARGS__)
#define fmt(...) gbd_ns::_gbd1(#__VA_ARGS__,__VA_ARGS__)
template<class Fun> struct _y_combinator_result {
	Fun _fun;
	template<class T> explicit _y_combinator_result(T &&fun) : _fun(forward<T>(fun)) {}
	template<typename... Args> decltype(auto) operator()(Args &&... args) {
		return _fun(ref(*this),forward<Args>(args)...);
	}
};
template<class Fun> [[nodiscard]] decltype(auto) fix(Fun &&fun) {
	return _y_combinator_result<decay_t<Fun>>(forward<Fun>(fun));
}
#define nop void()
#define sz(x) (int((x).size()))
#define all(v) (v).begin(),(v).end()
#define sortu(v) (sort(all(v)), (v).resize(unique(all(v))-begin(v)))
#define forenum(i,...) for(int i:{-1}) for(__VA_ARGS__) if(++i,0) assert(0); else
#define forenumll(i,...) for(long long i:{-1}) for(__VA_ARGS__) if(++i,0) assert(0); else
#define forbs(k,i,bs) for(ptrdiff_t k=0,i=(bs)._Find_first();i<(ptrdiff_t)(bs).size();i=(bs)._Find_next(i),++k)
#define fordbs(k,i,bs) for(ptrdiff_t k=0,i=(bs).find_first();i<(ptrdiff_t)(bs).size();i=(bs).find_next(i),++k)
#define get(x,i) get<i>(x)
template<class T> bool inb(const T &x,const T &l,const T &r) { return l<=x&&x<=r; }
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#ifdef EXTS
template<class S,class T> using omap=__gnu_pbds::tree<S,T,less<S>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>;
template<class T> using oset=omap<T,__gnu_pbds::null_type>;
template<class T> using rope=__gnu_cxx::rope<T>;
using dbitset=tr2::dynamic_bitset<>;
#endif
constexpr int e0=1, e1=10, e2=100, e3=1000;
constexpr int e4=10*e3, e5=100*e3, e6=1000*e3;
constexpr int e7=10*e6, e8=100*e6, e9=1000*e6;
constexpr long long e10=10LL*e9, e11=100LL*e9, e12=1000LL*e9;
constexpr long long e13=10*e12, e14=100*e12, e15=1000*e12;
constexpr long long e16=10*e15, e17=100*e15, e18=1000*e15;
constexpr __int128_t e21=__int128_t(e3)*e18, e24=__int128_t(e6)*e18, e27=__int128_t(e9)*e18;
constexpr __int128_t e30=e3*e27, e33=e6*e27, e36=e9*e27;
using ulll=__uint128_t;
using lll=__int128_t;
using ull=unsigned long long;
using ll=long long;
using ld=long double;
#ifdef EXTS
using lld=__float128;
#endif
long long START_TIME=chrono::duration_cast<chrono::microseconds>(chrono::steady_clock::now().time_since_epoch()).count();
inline long long now_U_03BC_s() { return chrono::duration_cast<chrono::microseconds>(chrono::steady_clock::now().time_since_epoch()).count()-START_TIME; }
const char *fmt_time(long long U_03BC_s=now_U_03BC_s()) { static char dur[20]; sprintf(dur,"%llu.%03llus",U_03BC_s/e6,(U_03BC_s%e6)/e3); return dur; }
#define timed(cb) do { dbg("timed "#cb" ..."); unsigned long long start=now_U_03BC_s(); cb; dbg("timed "#cb" took",fmt_time(now_U_03BC_s()-start)); } while(0)
int arg1; bool inp; vector<string> args;
unsigned seed=unsigned(JO&&getenv("sd")?atoi(getenv("sd")):OJ?START_TIME:START_TIME%e5);
mt19937 igen(seed<<1),gen(seed<<1|1);
#define irand(...) _rand(igen,__VA_ARGS__)
#define rand(...) _rand(gen,__VA_ARGS__)
template<class T> enable_if_t<numeric_limits<T>::is_integer,T> _rand(mt19937 &g,T l,T r) { return uniform_int_distribution<T>(l,r)(g); }
template<class T> enable_if_t<numeric_limits<T>::is_integer,T> _rand(mt19937 &g,T n) { return _rand(g,T(1),n); }
[[deprecated]] int _rand(mt19937 &g) { return _rand(g,0,numeric_limits<int>::max()); }
template<class T> enable_if_t<numeric_limits<T>::is_iec559,T> _rand(mt19937 &g,T l,T r) { return uniform_real_distribution<T>(l,r)(g); }
bool _rand(mt19937 &g,double p) { return bernoulli_distribution(p)(g); }
template<class T> T _rand(mt19937 &g,initializer_list<T> il) { return *(il.begin()+_rand(g,0,(int)il.size()-1)); }
template<class T> T _rand(mt19937 &g,double p,T a,T b) { return _rand(g,p)?a:b; }
template<class T> T _rand(mt19937 &g,initializer_list<T> il,initializer_list<double> wt) { assert(il.size()==wt.size()); return *(il.begin()+discrete_distribution<int>(wt)(g)); }
#define random_shuffle(...) static_assert(false,"random_shuffle deprecated, use shuffle")
#define ine(x,e) (inp?cin>>(x),nop:((x)=(e),nop))
#define inr(x,...) ine(x,irand(__VA_ARGS__))
#define endl '\n'
string garb;
void exit0() { DBG=1; dbgt("gg (early)"); exit(0); }
#ifndef MAIN
#define MAIN _main
#endif
void MAIN();
int32_t main([[maybe_unused]]int argc,[[maybe_unused]]char *argv[]) {
	ios_base::sync_with_stdio(0); cin.tie(0); cin.exceptions(ios_base::failbit | ios_base::badbit);
	arg1=0,args={argv,argv+argc};
	if(sz(args)>1) {
		if(args[1][0]=='i') freopen((string(__FILE__).substr(0,string(__FILE__).find('.'))+"."+args[1].substr(1)+".in").c_str(),"r",stdin);
		else if(args[1][0]=='I') freopen(args[1].substr(1).c_str(),"r",stdin);
		else arg1=stoi(args[1]);
	}
	inp=!arg1;
	if(JO && getenv("EMACS")) EMACS=1;
	dbgt(arg1,seed,args);
	#ifdef QUIET
	DBG=0;
	#endif
	MAIN();
	DBG=1;
	dbgt("gg;wp");
	return 0;
}
constexpr int inf=e9+99;
constexpr ll linf=1LL*e9*e9+99;
#if __cplusplus >= 202002L
constexpr long double U_03C4__ld=2*numbers::pi_v<long double>;
#else
const long double U_03C4__ld=2*acosl(-1);
#endif
#define U_03C4_ ((flt)U_03C4__ld)
constexpr long double U_03B5__ld=1e-8l;
#define U_03B5_ ((flt)U_03B5__ld)
// }}}
using flt=double; //CARE
constexpr int P=e9+7;//998'244'353;


const int N=55;
vector<vector<pair<int,int>>> rtd[N];
vector<pair<int,int>> zs[N];
vector<pair<int,int>> zz;

int used=0;

int ppp(int s,int j) {
	assert(inb(j,0,sz(rtd[s])-1));
	int u=++used;
	assert((rtd[s][j][0]==pair{-1,-1}));
	for(int k=1;k<sz(rtd[s][j]);k++) {
		int x=ppp(rtd[s][j][k].fi,rtd[s][j][k].se);
		zz.pb({u,x});
	}
	return u;
}

void pp(int s,int j) {
	assert(inb(j,0,sz(zs[s])-1));
	auto [a,b]=zs[s][j];
	if(!~a) return ppp(s,b),nop;
	a=ppp(s/2,a);
	b=ppp(s/2,b);
	zz.pb({a,b});
}

void PP(int n,vector<int> xs) {
	dbg(n,xs);
	for(int s=0;s<22;s++) for(int i=0;i<xs[s];i++) pp(s,i);
	assert(used==n);
	cout<<"YES"<<endl;
	cout<<sz(zz)<<endl;
	for(auto [u,v]:zz) cout<<u<<' '<<v<<endl;
}


void prep() {
	rtd[1].pb({{-1,-1}});
	zs[1].pb({-1,0});
	int sm=1;
	for(int s=2;s<N;s++) {
		if(s%2==0) for(int i=0;i<sz(rtd[s/2]);i++) for(int j=0;j<i;j++) zs[s].pb({i,j}), sm+=s;
		// dbg(s,sm);
		if(sm>1.1e6) break;
		for(int p=s;--p;) {
			if(sm>1.1e6) break;
			int a=s-p;
			for(int j=0;j<sz(rtd[p]);j++) {
				if(rtd[p][j].back().fi>a) break;
				for(int k=0;k<sz(rtd[a]);k++) {
					if(rtd[p][j].back()>=pair{a,k}) continue;
					if(a+a<s) zs[s].pb({-1,sz(rtd[s])}), sm+=s;
					rtd[s].pb(rtd[p][j]);
					rtd[s].back().pb({a,k});
				}
			}
		}
		// dbg(s,sm,sz(rtd[s]));
		if(sm>1.1e6) break;
	}
}




void _main() { /* CURSOR START */
	prep();

	for(int s=0;s<22;s++) dbg(s,sz(zs[s]));

	int n; ine(n,arg1);
	vector<int> alloc(22,0);
	if(n==7) {
		alloc[7]=1;
		return PP(n,alloc);
	}
	if(n>=8 || n==1) {
		int tot=0;
		for(int s=0;s<22;s++) {
			for(;n-tot>=s && alloc[s]<sz(zs[s]);) ++alloc[s], tot+=s;
		}
		for(;tot<n;) {
			for(int s=21;--s>=7;) {
				if(alloc[s]>0 && alloc[s+1]<sz(zs[s+1])) {
					++alloc[s+1];
					--alloc[s];
					++tot;
					goto yup;
				}
			}
			assert(0);
			yup:;
		}
		return PP(n,alloc);
	}
	if(n==6) {
		cout<<"YES\n6\n1 2\n2 3\n1 3\n3 4\n2 5\n5 6\n";
		return;
	}
	assert(inb(n,2,5));
	cout<<"NO"<<endl;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 35ms
memory: 56368kb

input:

1

output:

YES
0

result:

ok Everything ok

Test #2:

score: 0
Accepted
time: 27ms
memory: 56336kb

input:

6

output:

YES
6
1 2
2 3
1 3
3 4
2 5
5 6

result:

ok Everything ok

Test #3:

score: 0
Accepted
time: 27ms
memory: 56344kb

input:

4

output:

NO

result:

ok Everything ok

Test #4:

score: 0
Accepted
time: 43ms
memory: 56336kb

input:

2

output:

NO

result:

ok Everything ok

Test #5:

score: 0
Accepted
time: 50ms
memory: 56356kb

input:

3

output:

NO

result:

ok Everything ok

Test #6:

score: 0
Accepted
time: 53ms
memory: 56412kb

input:

5

output:

NO

result:

ok Everything ok

Test #7:

score: 0
Accepted
time: 37ms
memory: 56332kb

input:

7

output:

YES
6
1 2
3 4
1 3
6 7
5 6
1 5

result:

ok Everything ok

Test #8:

score: 0
Accepted
time: 28ms
memory: 56216kb

input:

8

output:

YES
6
2 3
4 5
2 4
7 8
6 7
2 6

result:

ok Everything ok

Test #9:

score: 0
Accepted
time: 31ms
memory: 56412kb

input:

9

output:

YES
7
4 5
3 4
2 3
6 7
8 9
6 8
2 6

result:

ok Everything ok

Test #10:

score: 0
Accepted
time: 38ms
memory: 56464kb

input:

10

output:

YES
8
2 3
5 6
4 5
2 4
7 8
9 10
7 9
2 7

result:

ok Everything ok

Test #11:

score: 0
Accepted
time: 41ms
memory: 56184kb

input:

11

output:

YES
9
3 4
5 6
3 5
2 3
7 8
10 11
9 10
7 9
2 7

result:

ok Everything ok

Test #12:

score: 0
Accepted
time: 35ms
memory: 56392kb

input:

12

output:

YES
10
2 3
4 5
2 4
7 8
6 7
2 6
9 10
11 12
9 11
2 9

result:

ok Everything ok

Test #13:

score: 0
Accepted
time: 39ms
memory: 56368kb

input:

13

output:

YES
11
2 3
4 5
6 7
4 6
2 4
9 10
8 9
12 13
11 12
8 11
2 8

result:

ok Everything ok

Test #14:

score: 0
Accepted
time: 45ms
memory: 56356kb

input:

14

output:

YES
12
2 3
5 6
4 5
2 4
7 8
9 10
7 9
2 7
13 14
12 13
11 12
2 11

result:

ok Everything ok

Test #15:

score: 0
Accepted
time: 28ms
memory: 56392kb

input:

15

output:

YES
13
3 4
2 3
5 6
7 8
5 7
2 5
9 10
11 12
9 11
14 15
13 14
9 13
2 9

result:

ok Everything ok

Test #16:

score: 0
Accepted
time: 38ms
memory: 56484kb

input:

16

output:

YES
13
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13

result:

ok Everything ok

Test #17:

score: 0
Accepted
time: 49ms
memory: 56352kb

input:

17

output:

YES
14
2 3
4 5
2 4
7 8
6 7
2 6
9 10
12 13
11 12
9 11
14 15
16 17
14 16
9 14

result:

ok Everything ok

Test #18:

score: 0
Accepted
time: 30ms
memory: 56336kb

input:

18

output:

YES
15
2 3
4 5
2 4
7 8
6 7
2 6
10 11
12 13
10 12
9 10
14 15
17 18
16 17
14 16
9 14

result:

ok Everything ok

Test #19:

score: 0
Accepted
time: 38ms
memory: 56212kb

input:

19

output:

YES
16
2 3
4 5
2 4
7 8
6 7
2 6
9 10
11 12
9 11
14 15
13 14
9 13
16 17
18 19
16 18
9 16

result:

ok Everything ok

Test #20:

score: 0
Accepted
time: 32ms
memory: 56400kb

input:

598

output:

YES
544
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 60
...

result:

ok Everything ok

Test #21:

score: 0
Accepted
time: 41ms
memory: 56460kb

input:

245

output:

YES
221
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 60
...

result:

ok Everything ok

Test #22:

score: 0
Accepted
time: 47ms
memory: 56412kb

input:

793

output:

YES
724
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 60
...

result:

ok Everything ok

Test #23:

score: 0
Accepted
time: 31ms
memory: 56360kb

input:

133

output:

YES
119
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 60
...

result:

ok Everything ok

Test #24:

score: 0
Accepted
time: 31ms
memory: 56464kb

input:

681

output:

YES
620
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 60
...

result:

ok Everything ok

Test #25:

score: 0
Accepted
time: 37ms
memory: 56296kb

input:

922

output:

YES
843
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 60
...

result:

ok Everything ok

Test #26:

score: 0
Accepted
time: 33ms
memory: 56228kb

input:

876

output:

YES
800
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 60
...

result:

ok Everything ok

Test #27:

score: 0
Accepted
time: 41ms
memory: 56420kb

input:

7740

output:

YES
7191
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 60...

result:

ok Everything ok

Test #28:

score: 0
Accepted
time: 35ms
memory: 56292kb

input:

2460

output:

YES
2268
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 60...

result:

ok Everything ok

Test #29:

score: 0
Accepted
time: 45ms
memory: 56412kb

input:

7533

output:

YES
6998
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 60...

result:

ok Everything ok

Test #30:

score: 0
Accepted
time: 37ms
memory: 56368kb

input:

5957

output:

YES
5527
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 60...

result:

ok Everything ok

Test #31:

score: 0
Accepted
time: 56ms
memory: 57708kb

input:

92651

output:

YES
87225
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 6...

result:

ok Everything ok

Test #32:

score: 0
Accepted
time: 34ms
memory: 56860kb

input:

58779

output:

YES
55235
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 6...

result:

ok Everything ok

Test #33:

score: 0
Accepted
time: 27ms
memory: 56340kb

input:

12203

output:

YES
11374
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 6...

result:

ok Everything ok

Test #34:

score: 0
Accepted
time: 57ms
memory: 56996kb

input:

55627

output:

YES
52258
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 6...

result:

ok Everything ok

Test #35:

score: 0
Accepted
time: 61ms
memory: 57732kb

input:

99051

output:

YES
93269
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 6...

result:

ok Everything ok

Test #36:

score: 0
Accepted
time: 100ms
memory: 70056kb

input:

811713

output:

YES
770513
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 ...

result:

ok Everything ok

Test #37:

score: 0
Accepted
time: 99ms
memory: 64012kb

input:

544133

output:

YES
515717
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 ...

result:

ok Everything ok

Test #38:

score: 0
Accepted
time: 60ms
memory: 60056kb

input:

276553

output:

YES
261516
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 ...

result:

ok Everything ok

Test #39:

score: 0
Accepted
time: 89ms
memory: 69592kb

input:

736904

output:

YES
699266
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 ...

result:

ok Everything ok

Test #40:

score: 0
Accepted
time: 110ms
memory: 71404kb

input:

1000000

output:

YES
949834
2 3
4 5
2 4
7 8
6 7
2 6
11 12
10 11
9 10
13 14
15 16
13 15
9 13
17 18
20 21
19 20
17 19
22 23
24 25
22 24
17 22
26 27
29 30
28 29
26 28
33 34
32 33
31 32
26 31
36 37
38 39
36 38
35 36
42 43
41 42
40 41
35 40
45 46
47 48
45 47
44 45
49 50
52 53
51 52
49 51
44 49
57 58
56 57
55 56
54 55
59 ...

result:

ok Everything ok

Extra Test:

score: 0
Extra Test Passed