QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#824719 | #9770. Middle Point | ucup-team5318# | WA | 0ms | 3884kb | C++14 | 849b | 2024-12-21 15:23:23 | 2024-12-21 15:23:24 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1005;
int ans[4][N];
int t1, t2;
void solve(int &tot, int n, int x, int *a1, int *a2){
int L=0, R=n;
while(L<x&&x<R){
if((L+R)%2){
puts("-1");
exit(0);
}
int mid=(L+R)/2;
++tot;
a1[tot]=L, a2[tot]=R;
if(x==mid) break;
if(x<mid) R=mid;
else L=mid;
}
}
int main(){
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
memset(ans, -1, sizeof(ans));
int n, m, x, y;
scanf("%d%d%d%d", &n, &m, &x, &y);
solve(t1, n, x, ans[0], ans[2]);
solve(t2, m, y, ans[1], ans[3]);
int res=max(t1, t2);
printf("%d\n", res);
for(int i=1; i<=res; ++i){
if(i>t1) ans[0][i]=ans[2][i]=x;
if(i>t2) ans[1][i]=ans[3][i]=y;
printf("%d %d %d %d\n", ans[0][i], ans[1][i], ans[2][i], ans[3][i]);
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3736kb
input:
2 2 1 1
output:
1 0 0 2 2
result:
ok correct!
Test #2:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
8 8 5 0
output:
3 0 0 8 0 4 0 8 0 4 0 6 0
result:
ok correct!
Test #3:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
0 0 0 0
output:
0
result:
ok correct!
Test #4:
score: 0
Accepted
time: 0ms
memory: 3884kb
input:
2024 0 1012 0
output:
1 0 0 2024 0
result:
ok correct!
Test #5:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
2024 2024 2023 2023
output:
-1
result:
ok correct!
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 3884kb
input:
8 6 7 3
output:
3 0 0 8 6 4 3 8 3 6 3 8 3
result:
wrong answer (8,3) is not in S