QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#616750 | #9189. Make them Meet | liuziao | 21 | 2ms | 3824kb | C++23 | 1.8kb | 2024-10-06 11:05:14 | 2024-10-06 11:05:14 |
Judging History
answer
#include <bits/stdc++.h>
// #define int int64_t
const int kMaxN = 105, kMaxM = 1e4 + 5;
int n, m;
int u[kMaxM], v[kMaxM];
namespace Sub1 {
std::vector<std::vector<int>> res;
bool check() {
if (m != n - 1) return 0;
for (int i = 1; i <= m; ++i)
if (u[i] != 1 && v[i] != 1)
return 0;
return 1;
}
void solve() {
std::vector<int> tmp;
for (int i = 1; i <= n; ++i) tmp.emplace_back(1);
res.emplace_back(tmp);
for (auto &x : tmp) x = 0;
tmp[0] = tmp[1] = 1;
res.emplace_back(tmp);
for (auto &x : tmp) x = 1;
res.emplace_back(tmp);
std::cout << res.size() << '\n';
for (auto &vec : res) {
for (auto x : vec) std::cout << x << ' ';
std::cout << '\n';
}
}
} // namespace Sub1
namespace Sub3 {
bool check() {
if (m != n - 1) return 0;
for (int i = 1; i <= m; ++i)
if (abs(u[i] - v[i]) != 1)
return 0;
return 1;
}
void solve() {
std::cout << 450 << '\n';
for (int i = 1; i <= 450; ++i) {
if (i & 1) {
for (int j = 1; j <= n; ++j) {
std::cout << (j - 1) / 2 + 1 << ' ';
}
std::cout << '\n';
} else {
for (int j = 1; j <= n; ++j)
std::cout << j / 2 << ' ';
std::cout << '\n';
}
}
}
} // namespace Sub3
void dickdreamer() {
std::cin >> n >> m;
for (int i = 1; i <= m; ++i) {
std::cin >> u[i] >> v[i];
++u[i], ++v[i];
}
if (Sub1::check()) Sub1::solve();
else if (Sub3::check()) Sub3::solve();
}
int32_t main() {
#ifdef ORZXKR
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
int T = 1;
// std::cin >> T;
while (T--) dickdreamer();
// std::cerr << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 3520kb
input:
2 1 0 1
output:
3 1 1 1 1 1 1
result:
points 1.0
Test #2:
score: 10
Accepted
time: 0ms
memory: 3560kb
input:
3 2 0 1 0 2
output:
3 1 1 1 1 1 0 1 1 1
result:
points 1.0
Test #3:
score: 10
Accepted
time: 0ms
memory: 3744kb
input:
4 3 0 1 0 2 0 3
output:
3 1 1 1 1 1 1 0 0 1 1 1 1
result:
points 1.0
Test #4:
score: 10
Accepted
time: 0ms
memory: 3812kb
input:
99 98 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 37 0 38 0 39 0 40 0 41 0 42 0 43 0 44 0 45 0 46 0 47 0 48 0 49 0 50 0 51 0 52 0 53 0 54 0 55 0 56 0 57 0 58 0 59 0 60 0 6...
output:
3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
points 1.0
Test #5:
score: 10
Accepted
time: 0ms
memory: 3820kb
input:
100 99 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 37 0 38 0 39 0 40 0 41 0 42 0 43 0 44 0 45 0 46 0 47 0 48 0 49 0 50 0 51 0 52 0 53 0 54 0 55 0 56 0 57 0 58 0 59 0 60 0 ...
output:
3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
points 1.0
Subtask #2:
score: 0
Wrong Answer
Test #6:
score: 13
Accepted
time: 0ms
memory: 3816kb
input:
2 1 0 1
output:
3 1 1 1 1 1 1
result:
points 1.0
Test #7:
score: 0
Wrong Answer
time: 0ms
memory: 3488kb
input:
3 3 1 2 0 1 0 2
output:
result:
wrong output format Unexpected end of file - int32 expected
Subtask #3:
score: 11
Accepted
Test #15:
score: 11
Accepted
time: 0ms
memory: 3824kb
input:
2 1 0 1
output:
3 1 1 1 1 1 1
result:
points 1.0
Test #16:
score: 11
Accepted
time: 0ms
memory: 3488kb
input:
3 2 0 1 1 2
output:
450 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 ...
result:
points 1.0
Test #17:
score: 11
Accepted
time: 0ms
memory: 3500kb
input:
4 3 0 1 1 2 2 3
output:
450 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 ...
result:
points 1.0
Test #18:
score: 11
Accepted
time: 0ms
memory: 3560kb
input:
49 48 0 1 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 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48
output:
450 1 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 0 1 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 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 1...
result:
points 1.0
Test #19:
score: 11
Accepted
time: 2ms
memory: 3484kb
input:
99 98 0 1 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 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 5...
output:
450 1 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 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 0 1 1 2 2 3 3 4 ...
result:
points 1.0
Test #20:
score: 11
Accepted
time: 2ms
memory: 3800kb
input:
100 99 0 1 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 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 ...
output:
450 1 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 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 0 1 1 2 2 3 3...
result:
points 1.0
Test #21:
score: 11
Accepted
time: 1ms
memory: 3488kb
input:
64 63 0 1 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 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 5...
output:
450 1 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 0 1 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...
result:
points 1.0
Subtask #4:
score: 0
Wrong Answer
Dependency #1:
100%
Accepted
Dependency #3:
100%
Accepted
Test #22:
score: 36
Accepted
time: 0ms
memory: 3492kb
input:
2 1 0 1
output:
3 1 1 1 1 1 1
result:
points 1.0
Test #23:
score: 36
Accepted
time: 0ms
memory: 3492kb
input:
3 2 0 1 0 2
output:
3 1 1 1 1 1 0 1 1 1
result:
points 1.0
Test #24:
score: 36
Accepted
time: 0ms
memory: 3500kb
input:
4 3 0 1 0 2 0 3
output:
3 1 1 1 1 1 1 0 0 1 1 1 1
result:
points 1.0
Test #25:
score: 36
Accepted
time: 0ms
memory: 3528kb
input:
99 98 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 37 0 38 0 39 0 40 0 41 0 42 0 43 0 44 0 45 0 46 0 47 0 48 0 49 0 50 0 51 0 52 0 53 0 54 0 55 0 56 0 57 0 58 0 59 0 60 0 6...
output:
3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
points 1.0
Test #26:
score: 36
Accepted
time: 0ms
memory: 3624kb
input:
100 99 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 37 0 38 0 39 0 40 0 41 0 42 0 43 0 44 0 45 0 46 0 47 0 48 0 49 0 50 0 51 0 52 0 53 0 54 0 55 0 56 0 57 0 58 0 59 0 60 0 ...
output:
3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
points 1.0
Test #27:
score: 36
Accepted
time: 0ms
memory: 3468kb
input:
3 2 0 1 1 2
output:
450 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 1 2 0 1 1 1 ...
result:
points 1.0
Test #28:
score: 36
Accepted
time: 0ms
memory: 3524kb
input:
4 3 0 1 1 2 2 3
output:
450 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 0 1 1 2 1 1 2 2 ...
result:
points 1.0
Test #29:
score: 36
Accepted
time: 1ms
memory: 3812kb
input:
49 48 0 1 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 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48
output:
450 1 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 0 1 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 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 1...
result:
points 1.0
Test #30:
score: 36
Accepted
time: 2ms
memory: 3816kb
input:
99 98 0 1 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 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 5...
output:
450 1 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 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 0 1 1 2 2 3 3 4 ...
result:
points 1.0
Test #31:
score: 36
Accepted
time: 0ms
memory: 3512kb
input:
100 99 0 1 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 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 ...
output:
450 1 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 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 0 1 1 2 2 3 3...
result:
points 1.0
Test #32:
score: 36
Accepted
time: 1ms
memory: 3528kb
input:
64 63 0 1 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 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 5...
output:
450 1 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 0 1 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...
result:
points 1.0
Test #33:
score: 0
Wrong Answer
time: 0ms
memory: 3580kb
input:
5 4 2 1 3 2 4 1 1 0
output:
result:
wrong output format Unexpected end of file - int32 expected
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%