QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#602002 | #4325. Kraljice | zhenjianuo2025 | 100 ✓ | 77ms | 54436kb | C++14 | 2.7kb | 2024-09-30 17:26:24 | 2024-09-30 17:26:24 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define piii tuple<int,int,int>
#define mp make_pair
#define mt make_tuple
#define x first
#define y second
#define fi first
#define se second
#define ins insert
#define it iterator
#define lb lower_bound
#define ub upper_bound
#define exc(exp) if(exp)continue;
#define ret(exp) if(exp)return;
#define stop(exp) if(exp)break;
#define quit(sth) {sth;return;}
#define let(var...) int var;tie(var)
#define siz(vec) ((int)((vec).size()))
#define all(vec) (vec).begin(),(vec).end()
#define unq(vec) sort(all(vec)),(vec).erase(unique(all(vec)),(vec).end())
#define deb(var) cerr<<#var<<'='<<(var)<<"; "
#define debl(var) cerr<<#var<<'='<<(var)<<";\n"
#define db double
#define ll long long
#define int long long
#define inf (long long)(1e18)
mt19937 gen(random_device{}());
bool Max(int &x,int y){if(x<y)return x=y,1;return 0;}
bool Min(int &x,int y){if(x>y)return x=y,1;return 0;}
const int mod=1e9+7;
void Add(int &x,int y){x=x+y<mod?x+y:x+y-mod;}
int add(int x,int y){return x+y<mod?x+y:x+y-mod;}
int fpm(int x,int y){
int ans=1;for(;y;y>>=1,(x*=x)%=mod)if(y&1)(ans*=x)%=mod;return ans;
}
int n,kx,bx,ky,by,fl;
vector<pii> Ans;
void Put(int x,int y){
if(fl)fl=0;else Ans.pb({kx*x+bx,ky*y+by});
}
void sol1(int n){
if(n==1)quit(Put(1,1));
for(int i=n;i>=3;i-=2)
Put(1,i),Put(i-1,1),
Put(i,1),Put(1,i-1);
Put(2,2);
for(int i=3;i<=n-2;i+=2)
Put(2,i),Put(i+1,2),
Put(i,2),Put(2,i+1);
Put(2,n);
Put(n,n);Put(1,1),Put(n,2);
fl=1,bx+=kx*(n+1),kx=-kx,by+=2*ky;sol1(n-2);
}
vector<pii> sol2(int n){
sol1(n-1);
auto ans=Ans;
for(auto &t:ans)++t.x,++t.y;
let(x,y)=ans.back();ans.pop_back();
assert(x!=y);
ans.pb({1,y}),ans.pb({x,1}),ans.pb({x,y});
vector<int> free(0);
for(int i=2;i<=n;i++)
if(i!=x&&i!=y)free.pb(i);
assert(siz(free)&1);
for(int i=0;i+1<siz(free);i+=2){
ans.pb({1,free[i]}),ans.pb({free[i+1],1}),
ans.pb({free[i],1}),ans.pb({1,free[i+1]});
}
ans.pb({1,free.back()}),ans.pb({1,1}),ans.pb({free.back(),1});return ans;
}
void work(){
kx=ky=1;
cin>>n;
if(n==2)cout<<"1\n1 1\n";
else if(n&1){
cout<<n*n<<'\n';
sol1(n);
for(auto t:Ans)cout<<t.x<<' '<<t.y<<'\n';
}else{
cout<<n*n-2<<'\n';
auto ans=sol2(n);
for(auto t:ans)cout<<t.x<<' '<<t.y<<'\n';
}
}
signed main(){
ios::sync_with_stdio(0),
cin.tie(0),cout.tie(0);
int T=1;while(T--)work();
}
/*
* CONTINUE, NON-STOPPING, FOR THE FAITH
* START TYPING IF YOU DON'T KNOW WHAT TO DO
* STOP TYPING IF YOU DON'T KNOW WHAT YOU'RE DOING
*/
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 6
Accepted
Test #1:
score: 6
Accepted
time: 0ms
memory: 3560kb
input:
1
output:
1 1 1
result:
ok 1 queen(s)
Test #2:
score: 6
Accepted
time: 0ms
memory: 3604kb
input:
2
output:
1 1 1
result:
ok 1 queen(s)
Test #3:
score: 6
Accepted
time: 0ms
memory: 3564kb
input:
3
output:
9 1 3 2 1 3 1 1 2 2 2 2 3 3 3 1 1 3 2
result:
ok 9 queen(s)
Test #4:
score: 6
Accepted
time: 0ms
memory: 3564kb
input:
4
output:
14 2 4 3 2 4 2 2 3 3 3 3 4 4 4 2 2 1 3 4 1 4 3 1 2 1 1 2 1
result:
ok 14 queen(s)
Test #5:
score: 6
Accepted
time: 0ms
memory: 3828kb
input:
5
output:
25 1 5 4 1 5 1 1 4 1 3 2 1 3 1 1 2 2 2 2 3 4 2 3 2 2 4 2 5 5 5 1 1 5 2 4 3 3 3 5 4 4 4 4 5 3 5 5 3 3 4
result:
ok 25 queen(s)
Test #6:
score: 6
Accepted
time: 1ms
memory: 3632kb
input:
6
output:
34 2 6 5 2 6 2 2 5 2 4 3 2 4 2 2 3 3 3 3 4 5 3 4 3 3 5 3 6 6 6 2 2 6 3 5 4 4 4 6 5 5 5 5 6 4 6 6 4 1 5 4 1 4 5 1 2 3 1 2 1 1 3 1 6 1 1 6 1
result:
ok 34 queen(s)
Test #7:
score: 6
Accepted
time: 0ms
memory: 3868kb
input:
7
output:
49 1 7 6 1 7 1 1 6 1 5 4 1 5 1 1 4 1 3 2 1 3 1 1 2 2 2 2 3 4 2 3 2 2 4 2 5 6 2 5 2 2 6 2 7 7 7 1 1 7 2 4 3 3 3 7 6 7 5 6 3 5 3 7 4 6 4 6 5 4 4 5 4 6 6 6 7 3 7 7 3 3 4 4 5 5 5 3 6 4 6 4 7 5 7 3 5 5 6
result:
ok 49 queen(s)
Test #8:
score: 6
Accepted
time: 0ms
memory: 3628kb
input:
8
output:
62 2 8 7 2 8 2 2 7 2 6 5 2 6 2 2 5 2 4 3 2 4 2 2 3 3 3 3 4 5 3 4 3 3 5 3 6 7 3 6 3 3 7 3 8 8 8 2 2 8 3 5 4 4 4 8 7 8 6 7 4 6 4 8 5 7 5 7 6 5 5 6 5 7 7 7 8 4 8 8 4 4 5 5 6 6 6 4 7 5 7 5 8 6 8 4 6 1 7 6 1 6 7 1 2 3 1 2 1 1 3 1 4 5 1 4 1 1 5 1 8 1 1 8 1
result:
ok 62 queen(s)
Test #9:
score: 6
Accepted
time: 0ms
memory: 3788kb
input:
9
output:
81 1 9 8 1 9 1 1 8 1 7 6 1 7 1 1 6 1 5 4 1 5 1 1 4 1 3 2 1 3 1 1 2 2 2 2 3 4 2 3 2 2 4 2 5 6 2 5 2 2 6 2 7 8 2 7 2 2 8 2 9 9 9 1 1 9 2 4 3 3 3 9 8 9 7 6 3 5 3 9 6 9 5 8 3 7 3 9 4 8 4 8 5 6 4 7 4 8 6 8 7 4 4 5 4 8 8 8 9 3 9 9 3 3 4 6 5 7 5 3 8 3 7 4 5 5 5 3 6 4 6 4 7 6 6 5 6 4 8 4 9 7 9 3 5 7 6 6 7 5...
result:
ok 81 queen(s)
Test #10:
score: 6
Accepted
time: 0ms
memory: 3572kb
input:
10
output:
98 2 10 9 2 10 2 2 9 2 8 7 2 8 2 2 7 2 6 5 2 6 2 2 5 2 4 3 2 4 2 2 3 3 3 3 4 5 3 4 3 3 5 3 6 7 3 6 3 3 7 3 8 9 3 8 3 3 9 3 10 10 10 2 2 10 3 5 4 4 4 10 9 10 8 7 4 6 4 10 7 10 6 9 4 8 4 10 5 9 5 9 6 7 5 8 5 9 7 9 8 5 5 6 5 9 9 9 10 4 10 10 4 4 5 7 6 8 6 4 9 4 8 5 6 6 6 4 7 5 7 5 8 7 7 6 7 5 9 5 10 8 ...
result:
ok 98 queen(s)
Test #11:
score: 6
Accepted
time: 0ms
memory: 3824kb
input:
11
output:
121 1 11 10 1 11 1 1 10 1 9 8 1 9 1 1 8 1 7 6 1 7 1 1 6 1 5 4 1 5 1 1 4 1 3 2 1 3 1 1 2 2 2 2 3 4 2 3 2 2 4 2 5 6 2 5 2 2 6 2 7 8 2 7 2 2 8 2 9 10 2 9 2 2 10 2 11 11 11 1 1 11 2 4 3 3 3 11 10 11 9 6 3 5 3 11 8 11 7 8 3 7 3 11 6 11 5 10 3 9 3 11 4 10 4 10 5 8 4 9 4 10 6 10 7 6 4 7 4 10 8 10 9 4 4 5 4...
result:
ok 121 queen(s)
Test #12:
score: 6
Accepted
time: 0ms
memory: 3876kb
input:
12
output:
142 2 12 11 2 12 2 2 11 2 10 9 2 10 2 2 9 2 8 7 2 8 2 2 7 2 6 5 2 6 2 2 5 2 4 3 2 4 2 2 3 3 3 3 4 5 3 4 3 3 5 3 6 7 3 6 3 3 7 3 8 9 3 8 3 3 9 3 10 11 3 10 3 3 11 3 12 12 12 2 2 12 3 5 4 4 4 12 11 12 10 7 4 6 4 12 9 12 8 9 4 8 4 12 7 12 6 11 4 10 4 12 5 11 5 11 6 9 5 10 5 11 7 11 8 7 5 8 5 11 9 11 10...
result:
ok 142 queen(s)
Test #13:
score: 6
Accepted
time: 0ms
memory: 3632kb
input:
13
output:
169 1 13 12 1 13 1 1 12 1 11 10 1 11 1 1 10 1 9 8 1 9 1 1 8 1 7 6 1 7 1 1 6 1 5 4 1 5 1 1 4 1 3 2 1 3 1 1 2 2 2 2 3 4 2 3 2 2 4 2 5 6 2 5 2 2 6 2 7 8 2 7 2 2 8 2 9 10 2 9 2 2 10 2 11 12 2 11 2 2 12 2 13 13 13 1 1 13 2 4 3 3 3 13 12 13 11 6 3 5 3 13 10 13 9 8 3 7 3 13 8 13 7 10 3 9 3 13 6 13 5 12 3 1...
result:
ok 169 queen(s)
Test #14:
score: 6
Accepted
time: 0ms
memory: 3616kb
input:
14
output:
194 2 14 13 2 14 2 2 13 2 12 11 2 12 2 2 11 2 10 9 2 10 2 2 9 2 8 7 2 8 2 2 7 2 6 5 2 6 2 2 5 2 4 3 2 4 2 2 3 3 3 3 4 5 3 4 3 3 5 3 6 7 3 6 3 3 7 3 8 9 3 8 3 3 9 3 10 11 3 10 3 3 11 3 12 13 3 12 3 3 13 3 14 14 14 2 2 14 3 5 4 4 4 14 13 14 12 7 4 6 4 14 11 14 10 9 4 8 4 14 9 14 8 11 4 10 4 14 7 14 6 ...
result:
ok 194 queen(s)
Test #15:
score: 6
Accepted
time: 0ms
memory: 3572kb
input:
15
output:
225 1 15 14 1 15 1 1 14 1 13 12 1 13 1 1 12 1 11 10 1 11 1 1 10 1 9 8 1 9 1 1 8 1 7 6 1 7 1 1 6 1 5 4 1 5 1 1 4 1 3 2 1 3 1 1 2 2 2 2 3 4 2 3 2 2 4 2 5 6 2 5 2 2 6 2 7 8 2 7 2 2 8 2 9 10 2 9 2 2 10 2 11 12 2 11 2 2 12 2 13 14 2 13 2 2 14 2 15 15 15 1 1 15 2 4 3 3 3 15 14 15 13 6 3 5 3 15 12 15 11 8 ...
result:
ok 225 queen(s)
Test #16:
score: 6
Accepted
time: 0ms
memory: 3584kb
input:
16
output:
254 2 16 15 2 16 2 2 15 2 14 13 2 14 2 2 13 2 12 11 2 12 2 2 11 2 10 9 2 10 2 2 9 2 8 7 2 8 2 2 7 2 6 5 2 6 2 2 5 2 4 3 2 4 2 2 3 3 3 3 4 5 3 4 3 3 5 3 6 7 3 6 3 3 7 3 8 9 3 8 3 3 9 3 10 11 3 10 3 3 11 3 12 13 3 12 3 3 13 3 14 15 3 14 3 3 15 3 16 16 16 2 2 16 3 5 4 4 4 16 15 16 14 7 4 6 4 16 13 16 1...
result:
ok 254 queen(s)
Subtask #2:
score: 11
Accepted
Dependency #1:
100%
Accepted
Test #17:
score: 11
Accepted
time: 0ms
memory: 3616kb
input:
5
output:
25 1 5 4 1 5 1 1 4 1 3 2 1 3 1 1 2 2 2 2 3 4 2 3 2 2 4 2 5 5 5 1 1 5 2 4 3 3 3 5 4 4 4 4 5 3 5 5 3 3 4
result:
ok 25 queen(s)
Test #18:
score: 11
Accepted
time: 1ms
memory: 3736kb
input:
54
output:
2914 2 54 53 2 54 2 2 53 2 52 51 2 52 2 2 51 2 50 49 2 50 2 2 49 2 48 47 2 48 2 2 47 2 46 45 2 46 2 2 45 2 44 43 2 44 2 2 43 2 42 41 2 42 2 2 41 2 40 39 2 40 2 2 39 2 38 37 2 38 2 2 37 2 36 35 2 36 2 2 35 2 34 33 2 34 2 2 33 2 32 31 2 32 2 2 31 2 30 29 2 30 2 2 29 2 28 27 2 28 2 2 27 2 26 25 2 26 2 ...
result:
ok 2914 queen(s)
Test #19:
score: 11
Accepted
time: 0ms
memory: 3516kb
input:
19
output:
361 1 19 18 1 19 1 1 18 1 17 16 1 17 1 1 16 1 15 14 1 15 1 1 14 1 13 12 1 13 1 1 12 1 11 10 1 11 1 1 10 1 9 8 1 9 1 1 8 1 7 6 1 7 1 1 6 1 5 4 1 5 1 1 4 1 3 2 1 3 1 1 2 2 2 2 3 4 2 3 2 2 4 2 5 6 2 5 2 2 6 2 7 8 2 7 2 2 8 2 9 10 2 9 2 2 10 2 11 12 2 11 2 2 12 2 13 14 2 13 2 2 14 2 15 16 2 15 2 2 16 2 ...
result:
ok 361 queen(s)
Test #20:
score: 11
Accepted
time: 1ms
memory: 3928kb
input:
44
output:
1934 2 44 43 2 44 2 2 43 2 42 41 2 42 2 2 41 2 40 39 2 40 2 2 39 2 38 37 2 38 2 2 37 2 36 35 2 36 2 2 35 2 34 33 2 34 2 2 33 2 32 31 2 32 2 2 31 2 30 29 2 30 2 2 29 2 28 27 2 28 2 2 27 2 26 25 2 26 2 2 25 2 24 23 2 24 2 2 23 2 22 21 2 22 2 2 21 2 20 19 2 20 2 2 19 2 18 17 2 18 2 2 17 2 16 15 2 16 2 ...
result:
ok 1934 queen(s)
Test #21:
score: 11
Accepted
time: 0ms
memory: 3892kb
input:
27
output:
729 1 27 26 1 27 1 1 26 1 25 24 1 25 1 1 24 1 23 22 1 23 1 1 22 1 21 20 1 21 1 1 20 1 19 18 1 19 1 1 18 1 17 16 1 17 1 1 16 1 15 14 1 15 1 1 14 1 13 12 1 13 1 1 12 1 11 10 1 11 1 1 10 1 9 8 1 9 1 1 8 1 7 6 1 7 1 1 6 1 5 4 1 5 1 1 4 1 3 2 1 3 1 1 2 2 2 2 3 4 2 3 2 2 4 2 5 6 2 5 2 2 6 2 7 8 2 7 2 2 8 ...
result:
ok 729 queen(s)
Test #22:
score: 11
Accepted
time: 1ms
memory: 3904kb
input:
58
output:
3362 2 58 57 2 58 2 2 57 2 56 55 2 56 2 2 55 2 54 53 2 54 2 2 53 2 52 51 2 52 2 2 51 2 50 49 2 50 2 2 49 2 48 47 2 48 2 2 47 2 46 45 2 46 2 2 45 2 44 43 2 44 2 2 43 2 42 41 2 42 2 2 41 2 40 39 2 40 2 2 39 2 38 37 2 38 2 2 37 2 36 35 2 36 2 2 35 2 34 33 2 34 2 2 33 2 32 31 2 32 2 2 31 2 30 29 2 30 2 ...
result:
ok 3362 queen(s)
Test #23:
score: 11
Accepted
time: 1ms
memory: 3712kb
input:
51
output:
2601 1 51 50 1 51 1 1 50 1 49 48 1 49 1 1 48 1 47 46 1 47 1 1 46 1 45 44 1 45 1 1 44 1 43 42 1 43 1 1 42 1 41 40 1 41 1 1 40 1 39 38 1 39 1 1 38 1 37 36 1 37 1 1 36 1 35 34 1 35 1 1 34 1 33 32 1 33 1 1 32 1 31 30 1 31 1 1 30 1 29 28 1 29 1 1 28 1 27 26 1 27 1 1 26 1 25 24 1 25 1 1 24 1 23 22 1 23 1 ...
result:
ok 2601 queen(s)
Test #24:
score: 11
Accepted
time: 0ms
memory: 3788kb
input:
8
output:
62 2 8 7 2 8 2 2 7 2 6 5 2 6 2 2 5 2 4 3 2 4 2 2 3 3 3 3 4 5 3 4 3 3 5 3 6 7 3 6 3 3 7 3 8 8 8 2 2 8 3 5 4 4 4 8 7 8 6 7 4 6 4 8 5 7 5 7 6 5 5 6 5 7 7 7 8 4 8 8 4 4 5 5 6 6 6 4 7 5 7 5 8 6 8 4 6 1 7 6 1 6 7 1 2 3 1 2 1 1 3 1 4 5 1 4 1 1 5 1 8 1 1 8 1
result:
ok 62 queen(s)
Test #25:
score: 11
Accepted
time: 0ms
memory: 3572kb
input:
15
output:
225 1 15 14 1 15 1 1 14 1 13 12 1 13 1 1 12 1 11 10 1 11 1 1 10 1 9 8 1 9 1 1 8 1 7 6 1 7 1 1 6 1 5 4 1 5 1 1 4 1 3 2 1 3 1 1 2 2 2 2 3 4 2 3 2 2 4 2 5 6 2 5 2 2 6 2 7 8 2 7 2 2 8 2 9 10 2 9 2 2 10 2 11 12 2 11 2 2 12 2 13 14 2 13 2 2 14 2 15 15 15 1 1 15 2 4 3 3 3 15 14 15 13 6 3 5 3 15 12 15 11 8 ...
result:
ok 225 queen(s)
Test #26:
score: 11
Accepted
time: 0ms
memory: 3868kb
input:
4
output:
14 2 4 3 2 4 2 2 3 3 3 3 4 4 4 2 2 1 3 4 1 4 3 1 2 1 1 2 1
result:
ok 14 queen(s)
Test #27:
score: 11
Accepted
time: 0ms
memory: 3912kb
input:
57
output:
3249 1 57 56 1 57 1 1 56 1 55 54 1 55 1 1 54 1 53 52 1 53 1 1 52 1 51 50 1 51 1 1 50 1 49 48 1 49 1 1 48 1 47 46 1 47 1 1 46 1 45 44 1 45 1 1 44 1 43 42 1 43 1 1 42 1 41 40 1 41 1 1 40 1 39 38 1 39 1 1 38 1 37 36 1 37 1 1 36 1 35 34 1 35 1 1 34 1 33 32 1 33 1 1 32 1 31 30 1 31 1 1 30 1 29 28 1 29 1 ...
result:
ok 3249 queen(s)
Test #28:
score: 11
Accepted
time: 1ms
memory: 3620kb
input:
58
output:
3362 2 58 57 2 58 2 2 57 2 56 55 2 56 2 2 55 2 54 53 2 54 2 2 53 2 52 51 2 52 2 2 51 2 50 49 2 50 2 2 49 2 48 47 2 48 2 2 47 2 46 45 2 46 2 2 45 2 44 43 2 44 2 2 43 2 42 41 2 42 2 2 41 2 40 39 2 40 2 2 39 2 38 37 2 38 2 2 37 2 36 35 2 36 2 2 35 2 34 33 2 34 2 2 33 2 32 31 2 32 2 2 31 2 30 29 2 30 2 ...
result:
ok 3362 queen(s)
Test #29:
score: 11
Accepted
time: 1ms
memory: 3992kb
input:
61
output:
3721 1 61 60 1 61 1 1 60 1 59 58 1 59 1 1 58 1 57 56 1 57 1 1 56 1 55 54 1 55 1 1 54 1 53 52 1 53 1 1 52 1 51 50 1 51 1 1 50 1 49 48 1 49 1 1 48 1 47 46 1 47 1 1 46 1 45 44 1 45 1 1 44 1 43 42 1 43 1 1 42 1 41 40 1 41 1 1 40 1 39 38 1 39 1 1 38 1 37 36 1 37 1 1 36 1 35 34 1 35 1 1 34 1 33 32 1 33 1 ...
result:
ok 3721 queen(s)
Test #30:
score: 11
Accepted
time: 1ms
memory: 3688kb
input:
62
output:
3842 2 62 61 2 62 2 2 61 2 60 59 2 60 2 2 59 2 58 57 2 58 2 2 57 2 56 55 2 56 2 2 55 2 54 53 2 54 2 2 53 2 52 51 2 52 2 2 51 2 50 49 2 50 2 2 49 2 48 47 2 48 2 2 47 2 46 45 2 46 2 2 45 2 44 43 2 44 2 2 43 2 42 41 2 42 2 2 41 2 40 39 2 40 2 2 39 2 38 37 2 38 2 2 37 2 36 35 2 36 2 2 35 2 34 33 2 34 2 ...
result:
ok 3842 queen(s)
Test #31:
score: 11
Accepted
time: 1ms
memory: 3752kb
input:
63
output:
3969 1 63 62 1 63 1 1 62 1 61 60 1 61 1 1 60 1 59 58 1 59 1 1 58 1 57 56 1 57 1 1 56 1 55 54 1 55 1 1 54 1 53 52 1 53 1 1 52 1 51 50 1 51 1 1 50 1 49 48 1 49 1 1 48 1 47 46 1 47 1 1 46 1 45 44 1 45 1 1 44 1 43 42 1 43 1 1 42 1 41 40 1 41 1 1 40 1 39 38 1 39 1 1 38 1 37 36 1 37 1 1 36 1 35 34 1 35 1 ...
result:
ok 3969 queen(s)
Test #32:
score: 11
Accepted
time: 1ms
memory: 3700kb
input:
64
output:
4094 2 64 63 2 64 2 2 63 2 62 61 2 62 2 2 61 2 60 59 2 60 2 2 59 2 58 57 2 58 2 2 57 2 56 55 2 56 2 2 55 2 54 53 2 54 2 2 53 2 52 51 2 52 2 2 51 2 50 49 2 50 2 2 49 2 48 47 2 48 2 2 47 2 46 45 2 46 2 2 45 2 44 43 2 44 2 2 43 2 42 41 2 42 2 2 41 2 40 39 2 40 2 2 39 2 38 37 2 38 2 2 37 2 36 35 2 36 2 ...
result:
ok 4094 queen(s)
Subtask #3:
score: 28
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #33:
score: 28
Accepted
time: 1ms
memory: 3752kb
input:
61
output:
3721 1 61 60 1 61 1 1 60 1 59 58 1 59 1 1 58 1 57 56 1 57 1 1 56 1 55 54 1 55 1 1 54 1 53 52 1 53 1 1 52 1 51 50 1 51 1 1 50 1 49 48 1 49 1 1 48 1 47 46 1 47 1 1 46 1 45 44 1 45 1 1 44 1 43 42 1 43 1 1 42 1 41 40 1 41 1 1 40 1 39 38 1 39 1 1 38 1 37 36 1 37 1 1 36 1 35 34 1 35 1 1 34 1 33 32 1 33 1 ...
result:
ok 3721 queen(s)
Test #34:
score: 28
Accepted
time: 0ms
memory: 3576kb
input:
10
output:
98 2 10 9 2 10 2 2 9 2 8 7 2 8 2 2 7 2 6 5 2 6 2 2 5 2 4 3 2 4 2 2 3 3 3 3 4 5 3 4 3 3 5 3 6 7 3 6 3 3 7 3 8 9 3 8 3 3 9 3 10 10 10 2 2 10 3 5 4 4 4 10 9 10 8 7 4 6 4 10 7 10 6 9 4 8 4 10 5 9 5 9 6 7 5 8 5 9 7 9 8 5 5 6 5 9 9 9 10 4 10 10 4 4 5 7 6 8 6 4 9 4 8 5 6 6 6 4 7 5 7 5 8 7 7 6 7 5 9 5 10 8 ...
result:
ok 98 queen(s)
Test #35:
score: 28
Accepted
time: 2ms
memory: 3888kb
input:
157
output:
24649 1 157 156 1 157 1 1 156 1 155 154 1 155 1 1 154 1 153 152 1 153 1 1 152 1 151 150 1 151 1 1 150 1 149 148 1 149 1 1 148 1 147 146 1 147 1 1 146 1 145 144 1 145 1 1 144 1 143 142 1 143 1 1 142 1 141 140 1 141 1 1 140 1 139 138 1 139 1 1 138 1 137 136 1 137 1 1 136 1 135 134 1 135 1 1 134 1 133 ...
result:
ok 24649 queen(s)
Test #36:
score: 28
Accepted
time: 0ms
memory: 3864kb
input:
12
output:
142 2 12 11 2 12 2 2 11 2 10 9 2 10 2 2 9 2 8 7 2 8 2 2 7 2 6 5 2 6 2 2 5 2 4 3 2 4 2 2 3 3 3 3 4 5 3 4 3 3 5 3 6 7 3 6 3 3 7 3 8 9 3 8 3 3 9 3 10 11 3 10 3 3 11 3 12 12 12 2 2 12 3 5 4 4 4 12 11 12 10 7 4 6 4 12 9 12 8 9 4 8 4 12 7 12 6 11 4 10 4 12 5 11 5 11 6 9 5 10 5 11 7 11 8 7 5 8 5 11 9 11 10...
result:
ok 142 queen(s)
Test #37:
score: 28
Accepted
time: 1ms
memory: 3696kb
input:
91
output:
8281 1 91 90 1 91 1 1 90 1 89 88 1 89 1 1 88 1 87 86 1 87 1 1 86 1 85 84 1 85 1 1 84 1 83 82 1 83 1 1 82 1 81 80 1 81 1 1 80 1 79 78 1 79 1 1 78 1 77 76 1 77 1 1 76 1 75 74 1 75 1 1 74 1 73 72 1 73 1 1 72 1 71 70 1 71 1 1 70 1 69 68 1 69 1 1 68 1 67 66 1 67 1 1 66 1 65 64 1 65 1 1 64 1 63 62 1 63 1 ...
result:
ok 8281 queen(s)
Test #38:
score: 28
Accepted
time: 1ms
memory: 3864kb
input:
84
output:
7054 2 84 83 2 84 2 2 83 2 82 81 2 82 2 2 81 2 80 79 2 80 2 2 79 2 78 77 2 78 2 2 77 2 76 75 2 76 2 2 75 2 74 73 2 74 2 2 73 2 72 71 2 72 2 2 71 2 70 69 2 70 2 2 69 2 68 67 2 68 2 2 67 2 66 65 2 66 2 2 65 2 64 63 2 64 2 2 63 2 62 61 2 62 2 2 61 2 60 59 2 60 2 2 59 2 58 57 2 58 2 2 57 2 56 55 2 56 2 ...
result:
ok 7054 queen(s)
Test #39:
score: 28
Accepted
time: 0ms
memory: 3884kb
input:
33
output:
1089 1 33 32 1 33 1 1 32 1 31 30 1 31 1 1 30 1 29 28 1 29 1 1 28 1 27 26 1 27 1 1 26 1 25 24 1 25 1 1 24 1 23 22 1 23 1 1 22 1 21 20 1 21 1 1 20 1 19 18 1 19 1 1 18 1 17 16 1 17 1 1 16 1 15 14 1 15 1 1 14 1 13 12 1 13 1 1 12 1 11 10 1 11 1 1 10 1 9 8 1 9 1 1 8 1 7 6 1 7 1 1 6 1 5 4 1 5 1 1 4 1 3 2 1...
result:
ok 1089 queen(s)
Test #40:
score: 28
Accepted
time: 1ms
memory: 3764kb
input:
94
output:
8834 2 94 93 2 94 2 2 93 2 92 91 2 92 2 2 91 2 90 89 2 90 2 2 89 2 88 87 2 88 2 2 87 2 86 85 2 86 2 2 85 2 84 83 2 84 2 2 83 2 82 81 2 82 2 2 81 2 80 79 2 80 2 2 79 2 78 77 2 78 2 2 77 2 76 75 2 76 2 2 75 2 74 73 2 74 2 2 73 2 72 71 2 72 2 2 71 2 70 69 2 70 2 2 69 2 68 67 2 68 2 2 67 2 66 65 2 66 2 ...
result:
ok 8834 queen(s)
Test #41:
score: 28
Accepted
time: 0ms
memory: 4244kb
input:
205
output:
42025 1 205 204 1 205 1 1 204 1 203 202 1 203 1 1 202 1 201 200 1 201 1 1 200 1 199 198 1 199 1 1 198 1 197 196 1 197 1 1 196 1 195 194 1 195 1 1 194 1 193 192 1 193 1 1 192 1 191 190 1 191 1 1 190 1 189 188 1 189 1 1 188 1 187 186 1 187 1 1 186 1 185 184 1 185 1 1 184 1 183 182 1 183 1 1 182 1 181 ...
result:
ok 42025 queen(s)
Test #42:
score: 28
Accepted
time: 0ms
memory: 3824kb
input:
4
output:
14 2 4 3 2 4 2 2 3 3 3 3 4 4 4 2 2 1 3 4 1 4 3 1 2 1 1 2 1
result:
ok 14 queen(s)
Test #43:
score: 28
Accepted
time: 5ms
memory: 4240kb
input:
237
output:
56169 1 237 236 1 237 1 1 236 1 235 234 1 235 1 1 234 1 233 232 1 233 1 1 232 1 231 230 1 231 1 1 230 1 229 228 1 229 1 1 228 1 227 226 1 227 1 1 226 1 225 224 1 225 1 1 224 1 223 222 1 223 1 1 222 1 221 220 1 221 1 1 220 1 219 218 1 219 1 1 218 1 217 216 1 217 1 1 216 1 215 214 1 215 1 1 214 1 213 ...
result:
ok 56169 queen(s)
Test #44:
score: 28
Accepted
time: 5ms
memory: 5828kb
input:
228
output:
51982 2 228 227 2 228 2 2 227 2 226 225 2 226 2 2 225 2 224 223 2 224 2 2 223 2 222 221 2 222 2 2 221 2 220 219 2 220 2 2 219 2 218 217 2 218 2 2 217 2 216 215 2 216 2 2 215 2 214 213 2 214 2 2 213 2 212 211 2 212 2 2 211 2 210 209 2 210 2 2 209 2 208 207 2 208 2 2 207 2 206 205 2 206 2 2 205 2 204 ...
result:
ok 51982 queen(s)
Test #45:
score: 28
Accepted
time: 2ms
memory: 4204kb
input:
245
output:
60025 1 245 244 1 245 1 1 244 1 243 242 1 243 1 1 242 1 241 240 1 241 1 1 240 1 239 238 1 239 1 1 238 1 237 236 1 237 1 1 236 1 235 234 1 235 1 1 234 1 233 232 1 233 1 1 232 1 231 230 1 231 1 1 230 1 229 228 1 229 1 1 228 1 227 226 1 227 1 1 226 1 225 224 1 225 1 1 224 1 223 222 1 223 1 1 222 1 221 ...
result:
ok 60025 queen(s)
Test #46:
score: 28
Accepted
time: 3ms
memory: 6472kb
input:
252
output:
63502 2 252 251 2 252 2 2 251 2 250 249 2 250 2 2 249 2 248 247 2 248 2 2 247 2 246 245 2 246 2 2 245 2 244 243 2 244 2 2 243 2 242 241 2 242 2 2 241 2 240 239 2 240 2 2 239 2 238 237 2 238 2 2 237 2 236 235 2 236 2 2 235 2 234 233 2 234 2 2 233 2 232 231 2 232 2 2 231 2 230 229 2 230 2 2 229 2 228 ...
result:
ok 63502 queen(s)
Test #47:
score: 28
Accepted
time: 6ms
memory: 4236kb
input:
255
output:
65025 1 255 254 1 255 1 1 254 1 253 252 1 253 1 1 252 1 251 250 1 251 1 1 250 1 249 248 1 249 1 1 248 1 247 246 1 247 1 1 246 1 245 244 1 245 1 1 244 1 243 242 1 243 1 1 242 1 241 240 1 241 1 1 240 1 239 238 1 239 1 1 238 1 237 236 1 237 1 1 236 1 235 234 1 235 1 1 234 1 233 232 1 233 1 1 232 1 231 ...
result:
ok 65025 queen(s)
Test #48:
score: 28
Accepted
time: 3ms
memory: 6328kb
input:
256
output:
65534 2 256 255 2 256 2 2 255 2 254 253 2 254 2 2 253 2 252 251 2 252 2 2 251 2 250 249 2 250 2 2 249 2 248 247 2 248 2 2 247 2 246 245 2 246 2 2 245 2 244 243 2 244 2 2 243 2 242 241 2 242 2 2 241 2 240 239 2 240 2 2 239 2 238 237 2 238 2 2 237 2 236 235 2 236 2 2 235 2 234 233 2 234 2 2 233 2 232 ...
result:
ok 65534 queen(s)
Subtask #4:
score: 55
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #49:
score: 55
Accepted
time: 0ms
memory: 3592kb
input:
27
output:
729 1 27 26 1 27 1 1 26 1 25 24 1 25 1 1 24 1 23 22 1 23 1 1 22 1 21 20 1 21 1 1 20 1 19 18 1 19 1 1 18 1 17 16 1 17 1 1 16 1 15 14 1 15 1 1 14 1 13 12 1 13 1 1 12 1 11 10 1 11 1 1 10 1 9 8 1 9 1 1 8 1 7 6 1 7 1 1 6 1 5 4 1 5 1 1 4 1 3 2 1 3 1 1 2 2 2 2 3 4 2 3 2 2 4 2 5 6 2 5 2 2 6 2 7 8 2 7 2 2 8 ...
result:
ok 729 queen(s)
Test #50:
score: 55
Accepted
time: 12ms
memory: 12708kb
input:
408
output:
166462 2 408 407 2 408 2 2 407 2 406 405 2 406 2 2 405 2 404 403 2 404 2 2 403 2 402 401 2 402 2 2 401 2 400 399 2 400 2 2 399 2 398 397 2 398 2 2 397 2 396 395 2 396 2 2 395 2 394 393 2 394 2 2 393 2 392 391 2 392 2 2 391 2 390 389 2 390 2 2 389 2 388 387 2 388 2 2 387 2 386 385 2 386 2 2 385 2 384...
result:
ok 166462 queen(s)
Test #51:
score: 55
Accepted
time: 47ms
memory: 21188kb
input:
747
output:
558009 1 747 746 1 747 1 1 746 1 745 744 1 745 1 1 744 1 743 742 1 743 1 1 742 1 741 740 1 741 1 1 740 1 739 738 1 739 1 1 738 1 737 736 1 737 1 1 736 1 735 734 1 735 1 1 734 1 733 732 1 733 1 1 732 1 731 730 1 731 1 1 730 1 729 728 1 729 1 1 728 1 727 726 1 727 1 1 726 1 725 724 1 725 1 1 724 1 723...
result:
ok 558009 queen(s)
Test #52:
score: 55
Accepted
time: 5ms
memory: 5256kb
input:
208
output:
43262 2 208 207 2 208 2 2 207 2 206 205 2 206 2 2 205 2 204 203 2 204 2 2 203 2 202 201 2 202 2 2 201 2 200 199 2 200 2 2 199 2 198 197 2 198 2 2 197 2 196 195 2 196 2 2 195 2 194 193 2 194 2 2 193 2 192 191 2 192 2 2 191 2 190 189 2 190 2 2 189 2 188 187 2 188 2 2 187 2 186 185 2 186 2 2 185 2 184 ...
result:
ok 43262 queen(s)
Test #53:
score: 55
Accepted
time: 13ms
memory: 8292kb
input:
457
output:
208849 1 457 456 1 457 1 1 456 1 455 454 1 455 1 1 454 1 453 452 1 453 1 1 452 1 451 450 1 451 1 1 450 1 449 448 1 449 1 1 448 1 447 446 1 447 1 1 446 1 445 444 1 445 1 1 444 1 443 442 1 443 1 1 442 1 441 440 1 441 1 1 440 1 439 438 1 439 1 1 438 1 437 436 1 437 1 1 436 1 435 434 1 435 1 1 434 1 433...
result:
ok 208849 queen(s)
Test #54:
score: 55
Accepted
time: 40ms
memory: 29640kb
input:
730
output:
532898 2 730 729 2 730 2 2 729 2 728 727 2 728 2 2 727 2 726 725 2 726 2 2 725 2 724 723 2 724 2 2 723 2 722 721 2 722 2 2 721 2 720 719 2 720 2 2 719 2 718 717 2 718 2 2 717 2 716 715 2 716 2 2 715 2 714 713 2 714 2 2 713 2 712 711 2 712 2 2 711 2 710 709 2 710 2 2 709 2 708 707 2 708 2 2 707 2 706...
result:
ok 532898 queen(s)
Test #55:
score: 55
Accepted
time: 21ms
memory: 9112kb
input:
509
output:
259081 1 509 508 1 509 1 1 508 1 507 506 1 507 1 1 506 1 505 504 1 505 1 1 504 1 503 502 1 503 1 1 502 1 501 500 1 501 1 1 500 1 499 498 1 499 1 1 498 1 497 496 1 497 1 1 496 1 495 494 1 495 1 1 494 1 493 492 1 493 1 1 492 1 491 490 1 491 1 1 490 1 489 488 1 489 1 1 488 1 487 486 1 487 1 1 486 1 485...
result:
ok 259081 queen(s)
Test #56:
score: 55
Accepted
time: 2ms
memory: 3820kb
input:
112
output:
12542 2 112 111 2 112 2 2 111 2 110 109 2 110 2 2 109 2 108 107 2 108 2 2 107 2 106 105 2 106 2 2 105 2 104 103 2 104 2 2 103 2 102 101 2 102 2 2 101 2 100 99 2 100 2 2 99 2 98 97 2 98 2 2 97 2 96 95 2 96 2 2 95 2 94 93 2 94 2 2 93 2 92 91 2 92 2 2 91 2 90 89 2 90 2 2 89 2 88 87 2 88 2 2 87 2 86 85 ...
result:
ok 12542 queen(s)
Test #57:
score: 55
Accepted
time: 2ms
memory: 3628kb
input:
119
output:
14161 1 119 118 1 119 1 1 118 1 117 116 1 117 1 1 116 1 115 114 1 115 1 1 114 1 113 112 1 113 1 1 112 1 111 110 1 111 1 1 110 1 109 108 1 109 1 1 108 1 107 106 1 107 1 1 106 1 105 104 1 105 1 1 104 1 103 102 1 103 1 1 102 1 101 100 1 101 1 1 100 1 99 98 1 99 1 1 98 1 97 96 1 97 1 1 96 1 95 94 1 95 1...
result:
ok 14161 queen(s)
Test #58:
score: 55
Accepted
time: 0ms
memory: 3596kb
input:
4
output:
14 2 4 3 2 4 2 2 3 3 3 3 4 4 4 2 2 1 3 4 1 4 3 1 2 1 1 2 1
result:
ok 14 queen(s)
Test #59:
score: 55
Accepted
time: 64ms
memory: 20856kb
input:
953
output:
908209 1 953 952 1 953 1 1 952 1 951 950 1 951 1 1 950 1 949 948 1 949 1 1 948 1 947 946 1 947 1 1 946 1 945 944 1 945 1 1 944 1 943 942 1 943 1 1 942 1 941 940 1 941 1 1 940 1 939 938 1 939 1 1 938 1 937 936 1 937 1 1 936 1 935 934 1 935 1 1 934 1 933 932 1 933 1 1 932 1 931 930 1 931 1 1 930 1 929...
result:
ok 908209 queen(s)
Test #60:
score: 55
Accepted
time: 72ms
memory: 51168kb
input:
1004
output:
1008014 2 1004 1003 2 1004 2 2 1003 2 1002 1001 2 1002 2 2 1001 2 1000 999 2 1000 2 2 999 2 998 997 2 998 2 2 997 2 996 995 2 996 2 2 995 2 994 993 2 994 2 2 993 2 992 991 2 992 2 2 991 2 990 989 2 990 2 2 989 2 988 987 2 988 2 2 987 2 986 985 2 986 2 2 985 2 984 983 2 984 2 2 983 2 982 981 2 982 2 ...
result:
ok 1008014 queen(s)
Test #61:
score: 55
Accepted
time: 75ms
memory: 21556kb
input:
1021
output:
1042441 1 1021 1020 1 1021 1 1 1020 1 1019 1018 1 1019 1 1 1018 1 1017 1016 1 1017 1 1 1016 1 1015 1014 1 1015 1 1 1014 1 1013 1012 1 1013 1 1 1012 1 1011 1010 1 1011 1 1 1010 1 1009 1008 1 1009 1 1 1008 1 1007 1006 1 1007 1 1 1006 1 1005 1004 1 1005 1 1 1004 1 1003 1002 1 1003 1 1 1002 1 1001 1000 ...
result:
ok 1042441 queen(s)
Test #62:
score: 55
Accepted
time: 56ms
memory: 48160kb
input:
948
output:
898702 2 948 947 2 948 2 2 947 2 946 945 2 946 2 2 945 2 944 943 2 944 2 2 943 2 942 941 2 942 2 2 941 2 940 939 2 940 2 2 939 2 938 937 2 938 2 2 937 2 936 935 2 936 2 2 935 2 934 933 2 934 2 2 933 2 932 931 2 932 2 2 931 2 930 929 2 930 2 2 929 2 928 927 2 928 2 2 927 2 926 925 2 926 2 2 925 2 924...
result:
ok 898702 queen(s)
Test #63:
score: 55
Accepted
time: 77ms
memory: 20448kb
input:
1023
output:
1046529 1 1023 1022 1 1023 1 1 1022 1 1021 1020 1 1021 1 1 1020 1 1019 1018 1 1019 1 1 1018 1 1017 1016 1 1017 1 1 1016 1 1015 1014 1 1015 1 1 1014 1 1013 1012 1 1013 1 1 1012 1 1011 1010 1 1011 1 1 1010 1 1009 1008 1 1009 1 1 1008 1 1007 1006 1 1007 1 1 1006 1 1005 1004 1 1005 1 1 1004 1 1003 1002 ...
result:
ok 1046529 queen(s)
Test #64:
score: 55
Accepted
time: 68ms
memory: 54436kb
input:
1024
output:
1048574 2 1024 1023 2 1024 2 2 1023 2 1022 1021 2 1022 2 2 1021 2 1020 1019 2 1020 2 2 1019 2 1018 1017 2 1018 2 2 1017 2 1016 1015 2 1016 2 2 1015 2 1014 1013 2 1014 2 2 1013 2 1012 1011 2 1012 2 2 1011 2 1010 1009 2 1010 2 2 1009 2 1008 1007 2 1008 2 2 1007 2 1006 1005 2 1006 2 2 1005 2 1004 1003 ...
result:
ok 1048574 queen(s)
Extra Test:
score: 0
Extra Test Passed