QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#66496 | #5154. ETA | karuna# | WA | 2ms | 3452kb | C++17 | 1.4kb | 2022-12-08 19:53:30 | 2022-12-08 19:53:33 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int sz = 1, lev[2020] = { 1, }, debug = 0;
vector<pair<int, int>> ans;
void make(int l) {
debug += l;
lev[l] = ++sz;
ans.push_back({ lev[l - 1], lev[l] });
}
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
int a = 0, b = 0, t = 0; string S; cin >> S;
for (int i = 0; i < S.size(); i++) {
if (S[i] == '/') ++t;
else if (t == 0) {
a = 10 * a + (S[i] & 15);
}
else {
b = 10 * b + (S[i] & 15);
}
}
if (a < b) {
if (a != b - 1) {
return !(cout << "impossible");
}
else {
for (int i = 2; i <= b; i++) {
make(1);
}
cout << sz << ' ' << ans.size() << '\n';
for (auto [x, y] : ans) {
cout << x << ' ' << y << '\n';
}
}
return 0;
}
int n = (1000 + b - 1) / b * b;
int x = n * a / b, s = 1;
for (int i = 2; i <= n; i++) {
if (x - s < n - i) {
make(x - n + i + 1);
for (int j = 0; j < n - i - 1; j++) make(1);
break;
}
else {
make(s);
x -= s++;
}
}
cout << sz << ' ' << ans.size() << '\n';
for (auto [x, y] : ans) {
cout << x << ' ' << y << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3452kb
input:
1/2
output:
2 1 1 2
result:
ok
Test #2:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
1/3
output:
impossible
result:
ok
Test #3:
score: -100
Wrong Answer
time: 2ms
memory: 3284kb
input:
7/4
output:
999 998 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 12 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55...
result:
FAIL Wrong average distance, got 1750/999, wanted 7/4