QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#824738 | #9770. Middle Point | ucup-team5318# | WA | 1ms | 3952kb | C++14 | 917b | 2024-12-21 15:29:47 | 2024-12-21 15:29:55 |
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;
int t3, t4;
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);
memset(ans, 0, sizeof(ans));
t1=res-t1, t2=res-t2;
solve(t1, n, x, ans[0], ans[2]);
solve(t2, m, y, ans[1], ans[3]);
printf("%d\n", res);
for(int i=1; i<=res; ++i){
printf("%d %d %d %d\n", ans[0][i], ans[1][i], ans[2][i], ans[3][i]);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3952kb
input:
2 2 1 1
output:
1 0 0 2 2
result:
ok correct!
Test #2:
score: 0
Accepted
time: 0ms
memory: 3800kb
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: 1ms
memory: 3820kb
input:
0 0 0 0
output:
0
result:
ok correct!
Test #4:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
2024 0 1012 0
output:
1 0 0 2024 0
result:
ok correct!
Test #5:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
2024 2024 2023 2023
output:
-1
result:
ok correct!
Test #6:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
8 6 7 3
output:
3 0 0 8 0 4 0 8 0 6 0 8 6
result:
ok correct!
Test #7:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
2024 2026 2024 2026
output:
0
result:
ok correct!
Test #8:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
1000000000 1000000000 70 0
output:
-1
result:
ok correct!
Test #9:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
3 6 2 4
output:
-1
result:
ok correct!
Test #10:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
7 7 7 2
output:
-1
result:
ok correct!
Test #11:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
6 2 5 2
output:
-1
result:
ok correct!
Test #12:
score: 0
Accepted
time: 0ms
memory: 3752kb
input:
5 7 5 5
output:
-1
result:
ok correct!
Test #13:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
4 7 2 3
output:
-1
result:
ok correct!
Test #14:
score: -100
Wrong Answer
time: 0ms
memory: 3764kb
input:
8 2 2 2
output:
2 0 0 8 0 0 0 4 0
result:
wrong answer target point have not been added into S