제출 #645121

#제출 시각아이디문제언어결과실행 시간메모리
645121VanillaSpeedrun (RMI21_speedrun)C++17
29 / 100
41 ms804 KiB
#include <bits/stdc++.h> #include "speedrun.h" using namespace std; const int maxn = 1e3 + 2; // vector <int> ad [maxn]; // bool ad [maxn][maxn]; void assignHints(int subtask, int N, int A[], int B[]) { /* your solution here */ int deg [N + 1] = {}; if (subtask == 1 || N <= 4) { setHintLen(N); for (int i = 1; i < N; i++){ setHint(A[i], B[i], 1); setHint(B[i], A[i], 1); } } if (subtask == 2) { setHintLen(1); for (int i = 1; i < N; i++){ deg[A[i]]++; deg[B[i]]++; } for (int i = 1; i <= N; i++){ if (deg[i] > 1) setHint(i, 1, 1); } } } void speedrun(int subtask, int N, int start) { /* your solution here */ if (subtask == 1 || N <= 4) { int vis [N + 1] = {}; auto dfs = [&] (int u, int p = -1, auto&& dfs) -> void { for (int i = 1; i <= N; i++){ if (i == p || i == start) continue; if (getHint(i)) { goTo(i); dfs(i, u, dfs); } } if (p != -1) goTo(p); }; dfs(start, -1, dfs); } if (subtask == 2) { if (!getHint(1)) { for (int i = 1; i <= N; i++){ if (goTo(i)) { start = i; break; } } } for (int i = 1; i <= N; i++){ if (i == start) continue; goTo(i); goTo(start); } } }

컴파일 시 표준 에러 (stderr) 메시지

speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:32:13: warning: unused variable 'vis' [-Wunused-variable]
   32 |         int vis [N + 1] = {};
      |             ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...