Submission #15408360


Source Code Expand

#include<bits/stdc++.h>
clock_t t=clock();
namespace my_std{
	using namespace std;
	#define pii pair<int,int>
	#define fir first
	#define sec second
	#define MP make_pair
	#define rep(i,x,y) for (int i=(x);i<=(y);i++)
	#define drep(i,x,y) for (int i=(x);i>=(y);i--)
	#define go(x) for (int i=head[x];i;i=edge[i].nxt)
	#define templ template<typename T>
	#define sz 2333
	typedef long long ll;
	typedef double db;
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	templ inline T rnd(T l,T r) {return uniform_int_distribution<T>(l,r)(rng);}
	templ inline bool chkmax(T &x,T y){return x<y?x=y,1:0;}
	templ inline bool chkmin(T &x,T y){return x>y?x=y,1:0;}
	templ inline void read(T& t)
	{
		t=0;char f=0,ch=getchar();double d=0.1;
		while(ch>'9'||ch<'0') f|=(ch=='-'),ch=getchar();
		while(ch<='9'&&ch>='0') t=t*10+ch-48,ch=getchar();
		if(ch=='.'){ch=getchar();while(ch<='9'&&ch>='0') t+=d*(ch^48),d*=0.1,ch=getchar();}
		t=(f?-t:t);
	}
	template<typename T,typename... Args>inline void read(T& t,Args&... args){read(t); read(args...);}
	char __sr[1<<21],__z[20];int __C=-1,__zz=0;
	inline void Ot(){fwrite(__sr,1,__C+1,stdout),__C=-1;}
	inline void print(register int x)
	{
		if(__C>1<<20)Ot();if(x<0)__sr[++__C]='-',x=-x;
		while(__z[++__zz]=x%10+48,x/=10);
		while(__sr[++__C]=__z[__zz],--__zz);__sr[++__C]='\n';
	}
	void file()
	{
		#ifdef NTFOrz
		freopen("a.in","r",stdin);
		#endif
	}
	inline void chktime()
	{
		#ifdef NTFOrz
		cout<<(clock()-t)/1000.0<<'\n';
		#endif
	}
	#ifdef mod
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x%mod) if (y&1) ret=ret*x%mod;return ret;}
	ll inv(ll x){return ksm(x,mod-2);}
	#else
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x) if (y&1) ret=ret*x;return ret;}
	#endif
//	inline ll mul(ll a,ll b){ll d=(ll)(a*(double)b/mod+0.5);ll ret=a*b-d*mod;if (ret<0) ret+=mod;return ret;}
}
using namespace my_std;

int n;
pii a[sz];

int main()
{
	file();
	read(n);
	rep(i,1,n) read(a[i].fir),a[i].sec=i;
	sort(a+1,a+n+1);
	if (a[1].fir*2<a[n].fir) return puts("-1"),0;
	for (int l=n;l;--l)
	{
		while (l!=1&&a[l-1].fir==a[l].fir) --l;
		while (a[l].fir!=a[l-1].fir)
		{
			rep(i,l,n) printf("%d ",a[i].sec),--a[i].fir;
			if (l!=1) rep(i,1,n) printf("%d ",a[i].sec),--a[i].fir;
		}
	}
	return 0;
}

Submission Info

Submission Time
Task E - Permutation Cover
User p_b_p_b
Language C++ (GCC 9.2.1)
Score 0
Code Size 2331 Byte
Status WA
Exec Time 8 ms
Memory 3780 KiB

Compile Error

./Main.cpp:31:33: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
   31 |  inline void print(register int x)
      |                                 ^
./Main.cpp: In function ‘void my_std::print(int)’:
./Main.cpp:33:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   33 |   if(__C>1<<20)Ot();if(x<0)__sr[++__C]='-',x=-x;
      |   ^~
./Main.cpp:33:21: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   33 |   if(__C>1<<20)Ot();if(x<0)__sr[++__C]='-',x=-x;
      |                     ^~
./Main.cpp:35:3: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation]
   35 |   while(__sr[++__C]=__z[__zz],--__zz);__sr[++__C]='\n';
      |   ^~~~~
./Main.cpp:35:39: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’
   35 |   while(__sr[++__C]=__z[__zz],--__zz);__sr[++__C]='\n';
      |                                       ^~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1500
Status
AC × 1
WA × 2
AC × 16
WA × 30
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt WA 8 ms 3676 KiB
02.txt WA 2 ms 3764 KiB
03.txt WA 2 ms 3664 KiB
04.txt WA 2 ms 3668 KiB
05.txt WA 2 ms 3712 KiB
06.txt WA 2 ms 3664 KiB
07.txt WA 5 ms 3472 KiB
08.txt WA 2 ms 3672 KiB
09.txt WA 2 ms 3692 KiB
10.txt WA 3 ms 3652 KiB
11.txt WA 2 ms 3604 KiB
12.txt WA 2 ms 3708 KiB
13.txt WA 2 ms 3676 KiB
14.txt WA 2 ms 3668 KiB
15.txt WA 2 ms 3548 KiB
16.txt WA 2 ms 3764 KiB
17.txt WA 2 ms 3712 KiB
18.txt WA 2 ms 3668 KiB
19.txt WA 2 ms 3768 KiB
20.txt WA 2 ms 3576 KiB
21.txt AC 2 ms 3604 KiB
22.txt AC 3 ms 3672 KiB
23.txt AC 2 ms 3712 KiB
24.txt AC 2 ms 3780 KiB
25.txt AC 2 ms 3580 KiB
26.txt AC 2 ms 3584 KiB
27.txt AC 3 ms 3608 KiB
28.txt AC 2 ms 3408 KiB
29.txt WA 2 ms 3604 KiB
30.txt WA 2 ms 3580 KiB
31.txt WA 2 ms 3668 KiB
32.txt WA 2 ms 3668 KiB
33.txt WA 2 ms 3780 KiB
34.txt AC 2 ms 3764 KiB
35.txt AC 2 ms 3532 KiB
36.txt WA 2 ms 3716 KiB
37.txt WA 2 ms 3708 KiB
38.txt AC 2 ms 3576 KiB
39.txt AC 3 ms 3472 KiB
40.txt AC 3 ms 3524 KiB
41.txt WA 2 ms 3652 KiB
42.txt AC 2 ms 3576 KiB
43.txt AC 2 ms 3564 KiB
s1.txt WA 3 ms 3600 KiB
s2.txt WA 2 ms 3580 KiB
s3.txt AC 2 ms 3608 KiB