QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#842520#9969. Kindergarten Squareucup-team6225#RE 0ms3684kbC++171.4kb2025-01-04 13:17:032025-01-04 13:17:16

Judging History

你现在查看的是最新测评结果

  • [2025-01-04 13:17:16]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:3684kb
  • [2025-01-04 13:17:03]
  • 提交

answer

#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;

const int N = 1000010, SZ = (1 << 18) + 5;
static char buf[SZ], *bgn = buf, *til = buf;
char getc() {
    if(bgn == til)  bgn = buf, til = buf + fread(buf, 1, SZ, stdin);
    return bgn == til ? EOF : *bgn++;
}
template<typename T>
void read(T &x) {
    char ch = getc();  T fh = 0;   x = 0;
    while(ch < '0' || ch > '9')    fh |= (ch == '-'), ch = getc();
    while(ch >= '0' && ch <= '9')   x = x * 10 + ch - '0', ch = getc();
    x = fh ? -x : x;
}
template<typename Type, typename... argc>
void read(Type &x, argc &...args)   {read(x), read(args...);}
template<typename T>
void print(T x) {
    if(x < 0)  putchar('-'), x = -x;
    if(x / 10)  print(x / 10);
    putchar(x % 10 + '0');
}
int a, b, c, d;
int main() {
    #ifdef Kelly
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        freopen("err.txt", "w", stderr);
    #endif
    int T = 1;  read(T);
    while(T--) {
        read(a, b, c, d);
        int w = c - a, h = (c - 1) / w + 1;
        if(a + 1 != b || c + 1 != d || d - b != w)  {cout << "-1\n";    continue;}
        int ida = (a - 1) % w + 1, idb = (b - 1) % w + 1;
        if(ida + 1 != idb)  {cout << "-1\n";  continue;}
        cout << h << " " << w << "\n";
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3608kb

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: 3684kb

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: -100
Runtime Error

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:


result: