QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#325706 | #412. Snowy Roads | bachbeo2007 | Compile Error | / | / | C++20 | 2.4kb | 2024-02-11 20:23:53 | 2024-02-11 20:23:54 |
Judging History
Anya
#include "Anyalib.h"
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define fi first
#define se second
namespace{
const int maxn = 505;
int n;
vector<int> ver;
vector<pii> edge[maxn];
int dep[maxn],pid[maxn],ind[maxn],cnt[maxn],par[maxn];
}
void InitAnya(int N, int A[] , int B[]) {
n=N;ver.clear();
for(int i=0;i<N;i++) edge[i].clear();
for(int i=0;i<N-1;i++){
edge[A[i]].push_back({B[i],i});
edge[B[i]].push_back({A[i],i});
}
function<int(int,int)> dfs = [&](int u,int p){
for(auto [v,id]:edge[u]) if(v!=p){
pid[v]=id;par[v]=u;
dep[u]=max(dep[u],(dfs(v,u)+1)%10);
}
//cout << u << ' ' << dep[u] << ' ' << par[u] << ' ' << pid[u] << '\n';
if(dep[u]==9){
ind[u]=(int)ver.size();
ver.push_back(u);
}
return dep[u];
};
par[0]=-1;
dfs(0,-1);
}
void Anya(int C[]) {
cnt[0]=0;
for(int i=1;i<n;i++) Save(i,C[pid[i]]);
function<void(int,int)> dfs = [&](int u,int p){
for(auto [v,id]:edge[u]) if(v!=p){
cnt[v]=cnt[u]+C[id];
dfs(v,u);
}
};
dfs(0,0);
for(int i=0;i<(int)ver.size();i++){
for(int j=0;j<9;j++) Save(n+9*i+j,cnt[ver[i]]>>j&1);
}
}
Boris
#include "Borislib.h"
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define fi first
#define se second
namespace{
const int maxn = 505;
int N;
vector<int> ver;
vector<pii> edge[maxn];
int dep[maxn],pid[maxn],ind[maxn],par[maxn];
}
void InitBoris(int N, int A[] , int B[]) {
n=N;ver.clear();
for(int i=0;i<N;i++) edge[i].clear();
for(int i=0;i<N-1;i++){
edge[A[i]].push_back({B[i],i});
edge[B[i]].push_back({A[i],i});
}
function<int(int,int)> dfs = [&](int u,int p){
for(auto [v,id]:edge[u]) if(v!=p){
pid[v]=id;par[v]=u;
dep[u]=max(dep[u],(dfs(v,u)+1)%10);
}
if(dep[u]==9){
ind[u]=(int)ver.size();
ver.push_back(u);
}
return dep[u];
};
par[0]=-1;
dfs(0,-1);
}
int Boris(int u){
int cnt=0;
while(u!=-1 && dep[u]!=9){
cnt+=Ask(u);
u=par[u];
}
if(u!=-1){
int x=ind[u];
for(int i=0;i<9;i++) cnt+=Ask(n+9*x+i)<<i;
}
return cnt;
}
Details
Boris.code: In function ‘void InitBoris(int, int*, int*)’: Boris.code:17:5: error: ‘n’ was not declared in this scope 17 | n=N;ver.clear(); | ^ Boris.code: In function ‘int Boris(int)’: Boris.code:46:39: error: ‘n’ was not declared in this scope 46 | for(int i=0;i<9;i++) cnt+=Ask(n+9*x+i)<<i; | ^ grader_Boris.cpp: In function ‘int Ask(int)’: grader_Boris.cpp:16:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d", &x); | ~~~~~^~~~~~~~~~ grader_Boris.cpp: In function ‘int main()’: grader_Boris.cpp:22:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | scanf("%d" , &N); | ~~~~~^~~~~~~~~~~ grader_Boris.cpp:23:37: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 23 | for(i = 0 ; i < N - 1 ; i++) scanf("%d%d" , &A[i] , &B[i]); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ grader_Boris.cpp:27:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 27 | scanf("%d", &x); | ~~~~~^~~~~~~~~~