QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#12469#397. Buddy NumbersRetucl100 ✓3ms3788kbC++111.7kb2021-07-19 14:09:532022-05-18 03:17:26

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-18 03:17:26]
  • 评测
  • 测评结果:100
  • 用时:3ms
  • 内存:3788kb
  • [2021-07-19 14:09:53]
  • 提交

answer

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int,int> pii;

void read(int &x){
    static char c;int f=0;
    while(!isdigit(c=getchar()))
        if(c^45) f=1;
    x=c^48;
    while(isdigit(c=getchar())) x=(x*10)+(c^48);
    if(f) x=-x;
}
void read(ll &x){
    static char c;int f=0;
    while(!isdigit(c=getchar()))
    if(c^45) f=1;
    x=c^48;
    while(isdigit(c=getchar())) x=(x*10)+(c^48);
}
void read(uint &x){
    static char c;
    while(!isdigit(c=getchar()));x=c^48;
    while(isdigit(c=getchar())) x=(x*10)+(c^48);
}
void read(ull &x){
    static char c;
    while(!isdigit(c=getchar()));x=c^48;
    while(isdigit(c=getchar())) x=(x*10)+(c^48);
}
void chkmax(int &x,int y){if(y>x)x=y;}
void chkmin(int &x,int y){if(y<x)x=y;}
void chkmax(ll &x,ll y){if(y>x)x=y;}
void chkmin(ll &x,ll y){if(y<x)x=y;}
void chkmax(uint &x,uint y){if(y>x)x=y;}
void chkmin(uint &x,uint y){if(y<x)x=y;}
void chkmax(ull &x,ull y){if(y>x)x=y;}
void chkmin(ull &x,ull y){if(y<x)x=y;}

const int N=2e3;
int vis[N+10],Prm[N+10],cnt;
void Euler(){
	vis[1]=1;
	for(int i=2;i<=N;++i){
		if(!vis[i]) Prm[++cnt]=i;
		for(int j=1;j<=cnt&&i*Prm[j]<=N;++j){
			vis[i*Prm[j]]=1;
			if(i%Prm[j]==0) break;
		}
	}
}

int n;

void Work(){
	read(n);
	if(n==1)
		return printf("1\n"),void();
	if(n==2)
		return printf("1 2\n"),void();
	if(n==3)
		return printf("3 1 2\n"),void();
	if(n==4)
		return printf("3 1 2 4\n"),void();
	if(n==6)
		return printf("5 1 3 6 2 4\n"),void();
	printf("-1\n");
}

int main(){Work();}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 1
Accepted
time: 3ms
memory: 3696kb

input:

1

output:

1

result:

ok good plan

Test #2:

score: 1
Accepted
time: 2ms
memory: 3620kb

input:

2

output:

1 2

result:

ok good plan

Test #3:

score: 1
Accepted
time: 0ms
memory: 3744kb

input:

3

output:

3 1 2

result:

ok good plan

Test #4:

score: 1
Accepted
time: 3ms
memory: 3696kb

input:

47

output:

-1

result:

ok No Solution

Test #5:

score: 1
Accepted
time: 1ms
memory: 3692kb

input:

6

output:

5 1 3 6 2 4

result:

ok good plan

Test #6:

score: 1
Accepted
time: 0ms
memory: 3632kb

input:

4

output:

3 1 2 4

result:

ok good plan

Test #7:

score: 1
Accepted
time: 2ms
memory: 3784kb

input:

752

output:

-1

result:

ok No Solution

Test #8:

score: 1
Accepted
time: 0ms
memory: 3740kb

input:

304

output:

-1

result:

ok No Solution

Test #9:

score: 1
Accepted
time: 3ms
memory: 3784kb

input:

5

output:

-1

result:

ok No Solution

Test #10:

score: 1
Accepted
time: 3ms
memory: 3712kb

input:

813

output:

-1

result:

ok No Solution

Test #11:

score: 1
Accepted
time: 1ms
memory: 3600kb

input:

589

output:

-1

result:

ok No Solution

Test #12:

score: 1
Accepted
time: 1ms
memory: 3696kb

input:

28

output:

-1

result:

ok No Solution

Test #13:

score: 1
Accepted
time: 0ms
memory: 3752kb

input:

851

output:

-1

result:

ok No Solution

Test #14:

score: 1
Accepted
time: 2ms
memory: 3696kb

input:

245

output:

-1

result:

ok No Solution

Test #15:

score: 1
Accepted
time: 2ms
memory: 3632kb

input:

507

output:

-1

result:

ok No Solution

Test #16:

score: 1
Accepted
time: 2ms
memory: 3596kb

input:

79

output:

-1

result:

ok No Solution

Test #17:

score: 1
Accepted
time: 2ms
memory: 3700kb

input:

462

output:

-1

result:

ok No Solution

Test #18:

score: 1
Accepted
time: 0ms
memory: 3716kb

input:

366

output:

-1

result:

ok No Solution

Test #19:

score: 1
Accepted
time: 2ms
memory: 3592kb

input:

899

output:

-1

result:

ok No Solution

Test #20:

score: 1
Accepted
time: 0ms
memory: 3632kb

input:

553

output:

-1

result:

ok No Solution

Test #21:

score: 1
Accepted
time: 2ms
memory: 3712kb

input:

884

output:

-1

result:

ok No Solution

Test #22:

score: 1
Accepted
time: 2ms
memory: 3580kb

input:

728

output:

-1

result:

ok No Solution

Test #23:

score: 1
Accepted
time: 2ms
memory: 3632kb

input:

987

output:

-1

result:

ok No Solution

Test #24:

score: 1
Accepted
time: 2ms
memory: 3580kb

input:

287

output:

-1

result:

ok No Solution

Test #25:

score: 1
Accepted
time: 2ms
memory: 3692kb

input:

804

output:

-1

result:

ok No Solution

Test #26:

score: 1
Accepted
time: 3ms
memory: 3728kb

input:

921

output:

-1

result:

ok No Solution

Test #27:

score: 1
Accepted
time: 2ms
memory: 3720kb

input:

217

output:

-1

result:

ok No Solution

Test #28:

score: 1
Accepted
time: 3ms
memory: 3716kb

input:

617

output:

-1

result:

ok No Solution

Test #29:

score: 1
Accepted
time: 3ms
memory: 3648kb

input:

71

output:

-1

result:

ok No Solution

Test #30:

score: 1
Accepted
time: 2ms
memory: 3708kb

input:

505

output:

-1

result:

ok No Solution

Test #31:

score: 1
Accepted
time: 2ms
memory: 3652kb

input:

508

output:

-1

result:

ok No Solution

Test #32:

score: 1
Accepted
time: 2ms
memory: 3728kb

input:

164

output:

-1

result:

ok No Solution

Test #33:

score: 1
Accepted
time: 2ms
memory: 3732kb

input:

867

output:

-1

result:

ok No Solution

Test #34:

score: 1
Accepted
time: 1ms
memory: 3712kb

input:

500

output:

-1

result:

ok No Solution

Test #35:

score: 1
Accepted
time: 2ms
memory: 3656kb

input:

554

output:

-1

result:

ok No Solution

Test #36:

score: 1
Accepted
time: 3ms
memory: 3744kb

input:

403

output:

-1

result:

ok No Solution

Test #37:

score: 1
Accepted
time: 1ms
memory: 3784kb

input:

494

output:

-1

result:

ok No Solution

Test #38:

score: 1
Accepted
time: 3ms
memory: 3692kb

input:

981

output:

-1

result:

ok No Solution

Test #39:

score: 1
Accepted
time: 0ms
memory: 3728kb

input:

197

output:

-1

result:

ok No Solution

Test #40:

score: 1
Accepted
time: 2ms
memory: 3656kb

input:

91

output:

-1

result:

ok No Solution

Test #41:

score: 1
Accepted
time: 3ms
memory: 3632kb

input:

488

output:

-1

result:

ok No Solution

Test #42:

score: 1
Accepted
time: 2ms
memory: 3652kb

input:

744

output:

-1

result:

ok No Solution

Test #43:

score: 1
Accepted
time: 2ms
memory: 3596kb

input:

401

output:

-1

result:

ok No Solution

Test #44:

score: 1
Accepted
time: 3ms
memory: 3628kb

input:

17

output:

-1

result:

ok No Solution

Test #45:

score: 1
Accepted
time: 2ms
memory: 3620kb

input:

826

output:

-1

result:

ok No Solution

Test #46:

score: 1
Accepted
time: 3ms
memory: 3744kb

input:

49

output:

-1

result:

ok No Solution

Test #47:

score: 1
Accepted
time: 2ms
memory: 3780kb

input:

681

output:

-1

result:

ok No Solution

Test #48:

score: 1
Accepted
time: 0ms
memory: 3516kb

input:

725

output:

-1

result:

ok No Solution

Test #49:

score: 1
Accepted
time: 0ms
memory: 3712kb

input:

647

output:

-1

result:

ok No Solution

Test #50:

score: 1
Accepted
time: 2ms
memory: 3648kb

input:

697

output:

-1

result:

ok No Solution

Test #51:

score: 1
Accepted
time: 0ms
memory: 3648kb

input:

762

output:

-1

result:

ok No Solution

Test #52:

score: 1
Accepted
time: 0ms
memory: 3780kb

input:

686

output:

-1

result:

ok No Solution

Test #53:

score: 1
Accepted
time: 2ms
memory: 3712kb

input:

283

output:

-1

result:

ok No Solution

Test #54:

score: 1
Accepted
time: 1ms
memory: 3600kb

input:

899

output:

-1

result:

ok No Solution

Test #55:

score: 1
Accepted
time: 2ms
memory: 3592kb

input:

54

output:

-1

result:

ok No Solution

Test #56:

score: 1
Accepted
time: 0ms
memory: 3692kb

input:

53

output:

-1

result:

ok No Solution

Test #57:

score: 1
Accepted
time: 3ms
memory: 3580kb

input:

843

output:

-1

result:

ok No Solution

Test #58:

score: 1
Accepted
time: 1ms
memory: 3712kb

input:

740

output:

-1

result:

ok No Solution

Test #59:

score: 1
Accepted
time: 1ms
memory: 3712kb

input:

892

output:

-1

result:

ok No Solution

Test #60:

score: 1
Accepted
time: 2ms
memory: 3632kb

input:

433

output:

-1

result:

ok No Solution

Test #61:

score: 1
Accepted
time: 1ms
memory: 3604kb

input:

782

output:

-1

result:

ok No Solution

Test #62:

score: 1
Accepted
time: 2ms
memory: 3784kb

input:

356

output:

-1

result:

ok No Solution

Test #63:

score: 1
Accepted
time: 1ms
memory: 3512kb

input:

156

output:

-1

result:

ok No Solution

Test #64:

score: 1
Accepted
time: 1ms
memory: 3780kb

input:

928

output:

-1

result:

ok No Solution

Test #65:

score: 1
Accepted
time: 3ms
memory: 3656kb

input:

944

output:

-1

result:

ok No Solution

Test #66:

score: 1
Accepted
time: 3ms
memory: 3712kb

input:

751

output:

-1

result:

ok No Solution

Test #67:

score: 1
Accepted
time: 2ms
memory: 3696kb

input:

235

output:

-1

result:

ok No Solution

Test #68:

score: 1
Accepted
time: 2ms
memory: 3656kb

input:

21

output:

-1

result:

ok No Solution

Test #69:

score: 1
Accepted
time: 3ms
memory: 3784kb

input:

876

output:

-1

result:

ok No Solution

Test #70:

score: 1
Accepted
time: 0ms
memory: 3720kb

input:

809

output:

-1

result:

ok No Solution

Test #71:

score: 1
Accepted
time: 1ms
memory: 3620kb

input:

724

output:

-1

result:

ok No Solution

Test #72:

score: 1
Accepted
time: 2ms
memory: 3720kb

input:

631

output:

-1

result:

ok No Solution

Test #73:

score: 1
Accepted
time: 3ms
memory: 3652kb

input:

332

output:

-1

result:

ok No Solution

Test #74:

score: 1
Accepted
time: 3ms
memory: 3600kb

input:

728

output:

-1

result:

ok No Solution

Test #75:

score: 1
Accepted
time: 3ms
memory: 3788kb

input:

985

output:

-1

result:

ok No Solution

Test #76:

score: 1
Accepted
time: 3ms
memory: 3652kb

input:

723

output:

-1

result:

ok No Solution

Test #77:

score: 1
Accepted
time: 2ms
memory: 3728kb

input:

876

output:

-1

result:

ok No Solution

Test #78:

score: 1
Accepted
time: 3ms
memory: 3692kb

input:

562

output:

-1

result:

ok No Solution

Test #79:

score: 1
Accepted
time: 0ms
memory: 3624kb

input:

873

output:

-1

result:

ok No Solution

Test #80:

score: 1
Accepted
time: 3ms
memory: 3648kb

input:

340

output:

-1

result:

ok No Solution

Test #81:

score: 1
Accepted
time: 1ms
memory: 3580kb

input:

466

output:

-1

result:

ok No Solution

Test #82:

score: 1
Accepted
time: 2ms
memory: 3696kb

input:

281

output:

-1

result:

ok No Solution

Test #83:

score: 1
Accepted
time: 1ms
memory: 3620kb

input:

730

output:

-1

result:

ok No Solution

Test #84:

score: 1
Accepted
time: 1ms
memory: 3632kb

input:

329

output:

-1

result:

ok No Solution

Test #85:

score: 1
Accepted
time: 2ms
memory: 3720kb

input:

843

output:

-1

result:

ok No Solution

Test #86:

score: 1
Accepted
time: 3ms
memory: 3628kb

input:

152

output:

-1

result:

ok No Solution

Test #87:

score: 1
Accepted
time: 2ms
memory: 3600kb

input:

411

output:

-1

result:

ok No Solution

Test #88:

score: 1
Accepted
time: 3ms
memory: 3720kb

input:

233

output:

-1

result:

ok No Solution

Test #89:

score: 1
Accepted
time: 2ms
memory: 3728kb

input:

194

output:

-1

result:

ok No Solution

Test #90:

score: 1
Accepted
time: 2ms
memory: 3716kb

input:

665

output:

-1

result:

ok No Solution

Test #91:

score: 1
Accepted
time: 0ms
memory: 3732kb

input:

78

output:

-1

result:

ok No Solution

Test #92:

score: 1
Accepted
time: 3ms
memory: 3716kb

input:

756

output:

-1

result:

ok No Solution

Test #93:

score: 1
Accepted
time: 0ms
memory: 3700kb

input:

885

output:

-1

result:

ok No Solution

Test #94:

score: 1
Accepted
time: 3ms
memory: 3656kb

input:

232

output:

-1

result:

ok No Solution

Test #95:

score: 1
Accepted
time: 2ms
memory: 3632kb

input:

634

output:

-1

result:

ok No Solution

Test #96:

score: 1
Accepted
time: 0ms
memory: 3784kb

input:

806

output:

-1

result:

ok No Solution

Test #97:

score: 1
Accepted
time: 2ms
memory: 3592kb

input:

40

output:

-1

result:

ok No Solution

Test #98:

score: 1
Accepted
time: 0ms
memory: 3708kb

input:

212

output:

-1

result:

ok No Solution

Test #99:

score: 1
Accepted
time: 2ms
memory: 3720kb

input:

675

output:

-1

result:

ok No Solution

Test #100:

score: 1
Accepted
time: 1ms
memory: 3720kb

input:

424

output:

-1

result:

ok No Solution