QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#851636#9969. Kindergarten Squareucup-team5071#RE 0ms3636kbC++201.4kb2025-01-10 21:36:552025-01-10 21:36:55

Judging History

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

  • [2025-01-10 21:36:55]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:3636kb
  • [2025-01-10 21:36:55]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
template <class T, size_t size = tuple_size<T>::value>
string to_debug(T, string s = "")
    requires(not ranges::range<T>);
string to_debug(auto x)
    requires requires(ostream& os) { os << x; }
{
    return static_cast<ostringstream>(ostringstream() << x).str();
}
string to_debug(ranges::range auto x, string s = "")
    requires(not is_same_v<decltype(x), string>)
{
    for (auto xi : x) {
        s += ", " + to_debug(xi);
    }
    return "[" + s.substr(s.empty() ? 0 : 2) + "]";
}
template <class T, size_t size>
string to_debug(T x, string s)
    requires(not ranges::range<T>)
{
    [&]<size_t... I>(index_sequence<I...>) {
        ((s += ", " + to_debug(get<I>(x))), ...);
    }(make_index_sequence<size>());
    return "(" + s.substr(s.empty() ? 0 : 2) + ")";
}
#ifndef ONLINE_JUDGE
#define debug(...)              \
    cerr << "line:" << __LINE__ \
         << ": (" #__VA_ARGS__ ") = " << to_debug(tuple(__VA_ARGS__)) << "\n"
#else
#define debug(...)

#endif

void solve() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a != b - 1 || c != d - 1 || a > c) {
        cout << "-1\n";
        return;
    }
    int w = c - a;
    if (a % w != 0) {
        cout << "100000 " << w << "\n";
    } else
        cout << "-1\n";
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;
    cin >> T;
    while (T--) solve();
    return 0;
}

詳細信息

Test #1:

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

input:

4
6 7
10 11
2 3
4 5
8 5
5 13
1 2
5 6

output:

100000 4
-1
-1
100000 4

result:

ok All testcases passed.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3636kb

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:

100000 3
-1
100000 4
100000 3
100000 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: