QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#844060 | #9969. Kindergarten Square | ucup-team6329# | AC ✓ | 0ms | 3700kb | C++14 | 789b | 2025-01-05 13:21:11 | 2025-01-05 13:21:11 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
int x=0,f=1;
char c=getchar();
while(c<'0' || c>'9')
{
if(c=='-') f=-1;
c=getchar();
}
while(c>='0' && c<='9')
{
x=x*10+c-'0';
c=getchar();
}
return x*f;
}
int a[5][5];
inline void Work()
{
int c1=a[1][2]-a[1][1];
int c2=a[2][2]-a[2][1];
if(c1!=1 || c2!=1)
{
cout<<"-1"<<endl;
return;
}
c1=a[2][1]-a[1][1];
c2=a[2][2]-a[1][2];
if(c1!=c2 || c1<2)
{
cout<<"-1"<<endl;
return;
}
int m=c1;
int n=(a[2][2]+m-1)/m;
if((a[1][1]+m-1)/m != (a[1][2]+m-1)/m)
{
cout<<"-1"<<endl;
return;
}
cout<<n<<" "<<m<<endl;
}
int main()
{
int T=read();
while(T--)
{
cin>>a[1][1]>>a[1][2]>>a[2][1]>>a[2][2];
Work();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3580kb
input:
4 6 7 10 11 2 3 4 5 8 5 5 13 1 2 5 6
output:
3 4 -1 -1 2 4
result:
ok All testcases passed.
Test #2:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
10 1 2 4 5 4 3 2 1 1 2 5 6 2 3 5 6 2 3 6 7 3 4 6 7 2 1 3 4 1 2 2 3 2 3 3 4 7 7 7 7
output:
2 3 -1 2 4 2 3 2 4 -1 -1 -1 -1 -1
result:
ok All testcases passed.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
10 1 1 1 1 1 2 3 4 1 2 5 7 4 5 7 8 1001 1002 1003 1004 1001 1002 1005 1007 1004 1005 1007 1008 249 250 251 252 250 251 250 251 250 250 250 251
output:
-1 2 2 -1 3 3 502 2 -1 336 3 126 2 -1 -1
result:
ok All testcases passed.
Test #4:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
10 249 251 250 251 249 250 250 251 249 250 251 251 249 250 251 251 51 52 61 62 50 52 61 62 52 52 61 62 51 51 61 62 51 53 61 62 51 52 60 62
output:
-1 -1 -1 -1 7 10 -1 -1 -1 -1 -1
result:
ok All testcases passed.
Test #5:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
10 51 52 62 62 51 52 61 61 51 52 61 63 109 110 119 120 108 110 119 120 110 110 119 120 109 109 119 120 109 111 119 120 109 110 118 120 109 110 120 120
output:
-1 -1 -1 12 10 -1 -1 -1 -1 -1 -1
result:
ok All testcases passed.
Test #6:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
10 109 110 119 119 109 110 119 121 1050 1075 2050 2075 1 2 1001 1002 101 102 1101 1102 999 1000 1999 2000 2 2 1001 1002 1 1 1001 1002 1 3 1001 1002 1 2 1000 1002
output:
-1 -1 -1 2 1000 2 1000 2 1000 -1 -1 -1 -1
result:
ok All testcases passed.
Test #7:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
10 1 2 1002 1002 1 2 1001 1001 1 2 1001 1003 100 102 1101 1102 102 102 1101 1102 101 101 1101 1102 101 103 1101 1102 101 102 1100 1102 101 102 1102 1102 101 102 1101 1101
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
result:
ok All testcases passed.
Test #8:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
10 101 102 1101 1103 998 1000 1999 2000 1000 1000 1999 2000 999 999 1999 2000 999 1001 1999 2000 999 1000 1998 2000 999 1000 2000 2000 999 1000 1999 1999 999 1000 1999 2001 48000 48002 49001 49002
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
result:
ok All testcases passed.
Test #9:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
10 48002 48002 49001 49002 48001 48001 49001 49002 48001 48003 49001 49002 48001 48002 49000 49002 48001 48002 49002 49002 48001 48002 49001 49001 48001 48002 49001 49003 48100 48102 49101 49102 48102 48102 49101 49102 48101 48101 49101 49102
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
result:
ok All testcases passed.
Test #10:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
10 48101 48103 49101 49102 48101 48102 49100 49102 48101 48102 49102 49102 48101 48102 49101 49101 48101 48102 49101 49103 48998 49000 49999 50000 49000 49000 49999 50000 48999 48999 49999 50000 48999 49001 49999 50000 48999 49000 49998 50000
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
result:
ok All testcases passed.
Test #11:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
10 48999 49000 50000 50000 48999 49000 49999 49999 1 2 1001 1002 1001 1002 1 2 2 1 1002 1001 1002 1001 2 1 2 1 1001 1002 1 2 1002 1001 50000 49999 1 2 1 49999 2 50000
output:
-1 -1 2 1000 -1 -1 -1 -1 -1 -1 -1
result:
ok All testcases passed.
Test #12:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
10 49997 49998 49999 50000 1 2 49998 49999 1 2 49999 50000 24999 25000 49999 50000 1 2 25001 25002 48001 48002 49001 49002 48101 48102 49101 49102 48999 49000 49999 50000 49993 49994 49998 49999 49992 49993 49997 49998
output:
25000 2 2 49997 2 49998 2 25000 2 25000 50 1000 50 1000 50 1000 10000 5 10000 5
result:
ok All testcases passed.
Test #13:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
10 49996 49997 49998 49999 49999 50000 49999 50000 1 3 49999 50000 2 3 49998 50000 1 2 49998 49998 1 2 49999 49999 1 25000 25001 50000 47000 46500 48000 47500 49992 49994 49998 49999 49992 49993 49996 49998
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
result:
ok All testcases passed.
Extra Test:
score: 0
Extra Test Passed