Task: | Distances |
Sender: | Kesatria_Komodo |
Submission time: | 2021-01-31 01:28:58 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | 1, 2 | details |
#2 | WRONG ANSWER | 0.01 s | 2 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:19:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] #define REP(i , n) for (int i = 0 ; i < (n) ; i++) ^ input/code.cpp:54:9: note: in expansion of macro 'REP' REP(i , ans.size()) ^~~ input/code.cpp:55:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] cout << ans[i] << (i + 1 == ans.size() ? '\n' : ' '); ~~~~~~^~~~~~~~~~~~~
Code
#include <iostream>#include <cstdio>#include <vector>#include <queue>#include <fstream>#include <bitset>#include <cassert>#include <functional>#include <cstring>#include <ctime>#include <cmath>#include <set>#include <map>#include <algorithm>#define sec second#define fir first#define pb push_back#define mp make_pair#define REP(i , n) for (int i = 0 ; i < (n) ; i++)#define BACK(i , n) for (int i = (n) - 1 ; i >= 0 ; i--)using namespace std;using vi = vector<int>;using vii = vector<vi>;using pii = pair<int , int>;using ll = long long;using ld = long double;const int MAX = 1e9 , MIN = - MAX , MOD = 1e9 + 7;const ll MAX_LL = 1e18 , MIN_LL = -MAX_LL;vector<int> ans;void dfs(int node , int bef , int depth , vector<int> adjl[]){if (depth % 3 == 0)ans.push_back(node);for (int it : adjl[node])if (it != bef)dfs(it , node , depth + 1 , adjl);if (depth % 3 != 0)ans.push_back(node);}int main(){int T;cin >> T;while(T--){ans.clear();int N;cin >> N;vector<int> adjl[N + 1];REP(i , N - 1){int a , b;cin >> a >> b;adjl[a].push_back(b);adjl[b].push_back(a);}dfs(1 , -1 , 0 , adjl);REP(i , ans.size())cout << ans[i] << (i + 1 == ans.size() ? '\n' : ' ');}}
Test details
Test 1
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
100 8 5 2 2 3 3 7 ... |
correct output |
---|
1 8 2 5 6 7 3 4 1 7 2 8 3 6 4 5 1 4 6 2 7 5 8 3 1 8 3 2 4 7 6 5 1 6 4 7 5 2 3 8 ... |
user output |
---|
1 3 5 6 2 7 8 4 1 8 2 7 3 6 4 5 1 4 8 7 2 5 6 3 1 3 8 2 4 7 6 5 1 6 3 5 2 7 4 8 ... Truncated |
Test 2
Group: 2
Verdict: WRONG ANSWER
input |
---|
100 100 37 59 81 37 44 81 ... |
correct output |
---|
1 99 82 81 59 5 71 55 17 24 13... |
user output |
---|
1 60 81 17 5 55 71 59 24 39 52... Truncated |