Submission #97144

#TimeUsernameProblemLanguageResultExecution timeMemory
97144maruiiSnowy Roads (JOI16_snowy)C++17
Compilation error
0 ms0 KiB
#include "Anyalib.h" #include <bits/stdc++.h> using namespace std; #define ff first #define ss second vector<int> edge[500]; int A[500], B[500], prt[500]; static int getL; void dfs(int x){ for(auto &i: edge[x]){ if(prt[x]==i) continue; prt[i] = x; dfs(i); } } void InitAnya(int N , int AA[] , int BB[]) { for(int i=0; i<N; ++i) edge[i].clear(); for(int i=0; i<N; ++i){ A[i] = AA[i], B[i] = BB[i]; edge[A[i]].push_back(B[i]); edge[B[i]].push_back(A[i]); } for(int i=0; i<N; ++i) sort(edge[i].begin(), edge[i].end()); dfs(0); } void Anya(int C[]) { for(int i=0; i<1000; ++i) Save(prt[A[i]]==B[i]?A[i]:B[i], C[i]); }
#include "Borislib.h" #include <bits/stdc++.h> using namespace std; #define ff first #define ss second /*vector<int> edge[500]; int A[500], B[500], prt[500]; static int getL; void dfs(int x){ for(auto &i: edge[x]){ if(prt[x]==i) continue; prt[i] = x; dfs(i); } }*/ void InitBoris(int N , int AA[] , int BB[]) { /*for(int i=0; i<N; ++i) edge[i].clear(); for(int i=0; i<N; ++i){ A[i] = AA[i], B[i] = BB[i]; edge[A[i]].push_back(B[i]); edge[B[i]].push_back(A[i]); } for(int i=0; i<N; ++i) sort(edge[i].begin(), edge[i].end()); dfs(0);*/ } int Boris(int city) { int ret = 0; while(city) ret += Ask(city), city = prt[city]; return Ask(city); }

Compilation message (stderr)

Anya.cpp:8:12: warning: 'getL' defined but not used [-Wunused-variable]
 static int getL;
            ^~~~
Anya.cpp: In function 'void Anya(int*)':
Anya.cpp:27:40: warning: iteration 500 invokes undefined behavior [-Waggressive-loop-optimizations]
  for(int i=0; i<1000; ++i) Save(prt[A[i]]==B[i]?A[i]:B[i], C[i]);
                                     ~~~^
Anya.cpp:27:16: note: within this loop
  for(int i=0; i<1000; ++i) Save(prt[A[i]]==B[i]?A[i]:B[i], C[i]);
               ~^~~~~

Boris.cpp: In function 'int Boris(int)':
Boris.cpp:29:39: error: 'prt' was not declared in this scope
  while(city) ret += Ask(city), city = prt[city];
                                       ^~~