QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#300950 | #7178. Bishops | ELDRVD | WA | 17ms | 7304kb | C++14 | 1.5kb | 2024-01-09 03:56:41 | 2024-01-09 03:56:42 |
Judging History
answer
//https://qoj.ac/contest/1356/problem/7178
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define PI acos(-1)
#define LSB(i) ((i) & -(i))
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define sc second
#define th third
#define fo fourth
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ldb double
#define INF 1e15
#define MOD 1000000007
#define endl "\n"
#define all(data) data.begin(),data.end()
#define TYPEMAX(type) std::numeric_limits<type>::max()
#define TYPEMIN(type) std::numeric_limits<type>::min()
#define MAXN 100007
vector<pll> v;
int main()
{
ios::sync_with_stdio(false); cin.tie(0);
ll n,m,x=0; cin>>n>>m;
if(n>m) {swap(n,m); x^=1;}
if(n==m)
{
for(int i=2;i<n;i++) v.pb({i,m});
for(int i=1;i<=n;i++) v.pb({i,1});
}
else if(n%2==0)
{
for(int i=1;i<=n;i++) v.pb({i,1});
for(int i=n/2-(m-1)%n/2+1; i<=(m-1)%n/2+n/2;i++) v.pb({i,(m-1)%n/2+n/2+1});
for(int i=1; i<=n;i++)
{
for(int j=1+n+(m-1)%n;j<=m;j+=n) v.pb({i,j});
}
}
else
{
for(int j=(n+1)/2+1;j<=m-(n+1)/2;j++) v.pb({(n+1)/2,j});
for(int i=1;i<=n;i++) v.pb({i,1}),v.pb({i,m});
}
if(x)
{
for(auto [mm,dd]:v) swap(mm,dd);
}
cout<<v.size()<<endl;
for(auto [mm,dd]:v) cout<<mm<<" "<<dd<<endl;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3584kb
input:
2 5
output:
6 1 1 2 1 1 3 1 5 2 3 2 5
result:
ok n: 2, m: 5, bishops: 6
Test #2:
score: 0
Accepted
time: 1ms
memory: 3392kb
input:
5 5
output:
8 2 5 3 5 4 5 1 1 2 1 3 1 4 1 5 1
result:
ok n: 5, m: 5, bishops: 8
Test #3:
score: 0
Accepted
time: 12ms
memory: 7272kb
input:
100000 100000
output:
199998 2 100000 3 100000 4 100000 5 100000 6 100000 7 100000 8 100000 9 100000 10 100000 11 100000 12 100000 13 100000 14 100000 15 100000 16 100000 17 100000 18 100000 19 100000 20 100000 21 100000 22 100000 23 100000 24 100000 25 100000 26 100000 27 100000 28 100000 29 100000 30 100000 31 100000 3...
result:
ok n: 100000, m: 100000, bishops: 199998
Test #4:
score: -100
Wrong Answer
time: 17ms
memory: 7304kb
input:
100000 99999
output:
199998 1 1 1 100000 2 1 2 100000 3 1 3 100000 4 1 4 100000 5 1 5 100000 6 1 6 100000 7 1 7 100000 8 1 8 100000 9 1 9 100000 10 1 10 100000 11 1 11 100000 12 1 12 100000 13 1 13 100000 14 1 14 100000 15 1 15 100000 16 1 16 100000 17 1 17 100000 18 1 18 100000 19 1 19 100000 20 1 20 100000 21 1 21 100...
result:
wrong answer Integer parameter [name=y] equals to 100000, violates the range [1, 99999]