| Task: | Building Teams |
| Sender: | aalto26bm_008 |
| Submission time: | 2026-09-07 16:44:49 +0300 |
| Language: | C++ (C++23) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | details |
| #2 | WRONG ANSWER | 0.00 s | details |
| #3 | WRONG ANSWER | 0.00 s | details |
| #4 | WRONG ANSWER | 0.00 s | details |
| #5 | WRONG ANSWER | 0.00 s | details |
| #6 | WRONG ANSWER | 0.23 s | details |
| #7 | WRONG ANSWER | 0.23 s | details |
| #8 | WRONG ANSWER | 0.23 s | details |
| #9 | WRONG ANSWER | 0.23 s | details |
| #10 | WRONG ANSWER | 0.23 s | details |
| #11 | WRONG ANSWER | 0.00 s | details |
| #12 | WRONG ANSWER | 0.00 s | details |
Compiler report
input/code.cpp: In function 'int main(int, char**)':
input/code.cpp:31:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
31 | while (i < f.size()) {
| ~~^~~~~~~~~~
input/code.cpp:58:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
58 | for (int i=1; i<result.size(); i++) {
| ~^~~~~~~~~~~~~~Code
#include <iostream>
#include <vector>
#include <algorithm>
#include <format>
int main(int argc, char **argv) {
int n, m;
std::cin >> n >> m;
std::vector<std::vector<int>> f;
std::vector<int> result(n + 1, 0);
for (int x=0; x<m; x++) {
int f1, f2;
std::cin >> f1 >> f2;
if (f1 < f2) {
f.push_back({f1, f2});
} else {
f.push_back({f2, f1});
}
}
std::sort(f.begin(), f.end());
//std::cout << std::format("{}", f) << std::endl;
int i = 0;
while (i < f.size()) {
int insert_a = f[i][0];
int insert_b = f[i][1];
//std::cout << "insert_a: " << insert_a << " insert_b: " << insert_b << std::endl;
if (result[insert_a] == 0 && result[insert_b] == 0) {
result[insert_a] = 1;
result[insert_b] = 2;
} else if (result[insert_a] != 0) {
if (result[insert_a] == 1) {
result[insert_b] = 2;
} else {
result[insert_b] = 1;
}
} else {
if (result[insert_b] == 1) {
result[insert_a] = 2;
} else {
result[insert_a] = 1;
}
}
i++;
}
for (int i=1; i<result.size(); i++) {
std::cout << result[i];
}
std::cout << std::endl;
return 0;
}Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 10 20 3 4 8 10 3 7 1 8 ... |
| correct output |
|---|
| 1 1 1 2 2 1 2 2 2 1 |
| user output |
|---|
| 1112212221 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 10 20 1 3 8 10 2 4 6 8 ... |
| correct output |
|---|
| 1 1 2 2 1 1 1 2 1 1 |
| user output |
|---|
| 1122111211 |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 10 20 7 10 3 10 9 10 2 10 ... |
| correct output |
|---|
| 1 2 2 1 1 1 2 1 2 1 |
| user output |
|---|
| 1112221212 |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 10 20 2 4 2 10 7 10 4 6 ... |
| correct output |
|---|
| 1 2 1 1 2 2 2 1 2 1 |
| user output |
|---|
| 1211222121 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 10 20 3 5 8 10 9 10 1 8 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 1112112221 |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 100000 200000 47355 96505 90709 92058 735 80715 91802 94265 ... |
| correct output |
|---|
| 1 2 2 1 2 1 1 1 2 2 1 2 1 1 1 ... |
| user output |
|---|
| 111110111101111111110111111101... |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 100000 200000 59991 95794 95150 96051 78453 94730 90411 95523 ... |
| correct output |
|---|
| 1 1 1 2 2 1 1 2 1 2 1 2 2 2 1 ... |
| user output |
|---|
| 101110111101110011111111101111... |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 100000 200000 89827 96402 65137 86792 80965 94708 19479 48078 ... |
| correct output |
|---|
| 1 2 1 1 2 1 2 2 2 1 2 1 1 2 1 ... |
| user output |
|---|
| 111111111111010110111111011110... |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 100000 200000 72952 83723 66197 70052 2949 52160 55753 95651 ... |
| correct output |
|---|
| 1 1 2 2 2 1 1 2 2 2 2 2 1 2 1 ... |
| user output |
|---|
| 111110111111111111111111111111... |
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 100000 200000 38942 96755 70049 82663 7746 72732 87819 99029 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 111111101111111111111011111111... |
Test 11
Verdict: WRONG ANSWER
| input |
|---|
| 5 4 1 2 3 4 4 5 5 3 |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 12121 |
Test 12
Verdict: WRONG ANSWER
| input |
|---|
| 4 5 1 2 1 4 2 3 2 4 ... |
| correct output |
|---|
| IMPOSSIBLE |
| user output |
|---|
| 1212 |
